Skip to content

Switch ​

Use bo-switch for a boolean setting with an optional label and description.

Usage ​

Email notificationsReceive project updates by email.
Enabled
<bo-switch>
  v-model="enabled"
  label="Email notifications"
  description="Receive project updates by email."
/>

Orientation and states ​

Use orientation="vertical" to stack the label content. required and disabled map to the control state.

Email notifications
Unavailable
<bo-switch>
  v-model="enabled"
  label="Email notifications"
  orientation="vertical"
/>

API ​

Prop / event / slotTypeDefaultDescription
id / dataTestIdstringautogeneratedControl attributes.
modelValuebooleanfalseChecked state used by v-model.
defaultValuebooleanfalseInitial state for uncontrolled usage.
orientationhorizontal | verticalhorizontalLabel layout.
label / descriptionstring-Text beside the control.
disabled / requiredbooleanfalseControl states.
name / valuestring-Native form attributes.
customColorstring | BoSwitchCustomColors-Track, border, and text colors.
customThumbColorstring-Thumb color override.
role / ariaLabel / ariaLabelledBy / ariaDescribedBynative accessibility typesswitch / -Control semantics.
update:modelValue(value: boolean) event-Emitted when the checked state changes.
defaultslot-Additional label content.

Released under the MIT License.