Skip to main content

BwToggle | bw-toggle

Overview

The toggle component is a form control and represent if a value is true/false or on/off.

Usage

Sizes

RegularLarge
<bw-toggle>Regular</bw-toggle>
<bw-toggle large>Large</bw-toggle>

Variants

Starting labelEnding labelDisabled
<bw-toggle label-placement="start">Starting label</bw-toggle>
<bw-toggle label-placement="end">Ending label</bw-toggle>
<bw-toggle disabled>Disabled</bw-toggle>

Properties

PropertyAttributeDescriptionTypeDefault
disableddisabledWhether or not the toggle is disabledbooleanfalse
labelPlacementlabel-placementIf the label should be placed at the start or end of the toggle"end" | "start"'end'
largelargeSize of the togglebooleanfalse
originalValueoriginal-valueThe default value the control will reset to in a form. If not set, will default to the inital value of the "value" property.booleanundefined
valuevalueWhether or not the toggle is activebooleanfalse

Events

EventDescriptionType
valueChangeEmits the new value whenever toggle is clickedCustomEvent<boolean>

Slots

SlotDescription
The label of the toggle

Shadow Parts

PartDescription
"toggle-thumb"The thumb of the toggle
"toggle-wrapper"The wrapper of the toggle

CSS Custom Properties

NameDescription
--active-backgroundBackground color when checked
--active-hover-backgroundBackground color when active and hovered
--disbaled-backgroundBackground color when disabled
--inactive-backgroundBackground color when not checked
--thumb-gutterGutter between the thumb and the wrapper
--thumb-sizeSize of the thumb
--thumb-wrapper-heightHeight of the thumb wrapper
--thumb-wrapper-widthWidth of the thumb wrapper

© 2025 United Systems & Software - All Rights Reserved.