Skip to content

Switch

<bh-switch>

The Switch component represents a binary on/off state with support for labels, multiple sizes, and rich customization options.

Basic Usage

Sizes

The Switch component supports three sizes:

SizeSwitch Dimensions
small50px × 25px
medium80px × 40px
large120px × 60px

Colors & States

Customize active/inactive switch colors and label color:

Checked State

You can set the switch default state as checked by setting the checked property:

Disabled State

You can disable the switch by setting the disabled property:

Properties

PropertyTypeDescription
sizestringSize of the switch: “small”, “medium”, “large”
switchLabelstringOptional label next to the switch
switchCheckedColorstringBackground color when switch is ON
switchDefaultColorstringBackground color when switch is OFF
labelColorstringColor of the switch label text
disabledbooleanIf true, disables interaction
checkedbooleanInitial checked state of the switch

Events

Event NamePayloadDescription
checkbox-selected{ value, checked }Fired when switch is toggled