Toggle Sidebar B
AppearanceLight & dark mode D

Switch

On/off toggle. Use for binary settings where the result is immediate (no Save button needed).

Default

Bound with v-model.

Dark previewReplay preview

With label

Pair with a Label for click targets.

Dark previewReplay preview

With description

Add a muted description under the label to explain what the toggle controls.

Dark previewReplay preview

Receive emails about new products.

Sizes

The size prop offers sm and default. For anything larger, scale with a utility class such as scale-125.

Dark previewReplay preview

Disabled

Disable input.

Dark previewReplay preview

Invalid

Set data-invalid on the Field and aria-invalid on the Switch, then use FieldError for the message.

Dark previewReplay preview

Turn this on to receive alerts on your devices.

Choice card

Wrap each Field inside a FieldLabel to turn switches into selectable cards. The active card is highlighted automatically.

Dark previewReplay preview

API Reference

Switch

PropTypeDefaultDescription
modelValuebooleanfalseChecked state. Supports v-model.
defaultValuebooleanfalseInitial state when v-model is not used.
disabledbooleanfalseDisable input.
idstringMatch with a Label for prop.
EventDescription
update:modelValueFires with the new checked state. Enables v-model.
SlotDescription
thumbOverride the sliding thumb content (e.g. an icon).

Accessibility

Keyboard shortcuts and ARIA behavior.

Shortcut Description
SpaceToggles the switch when focused.
EnterToggles the switch when focused.
TabMoves focus to or from the switch.
  • Uses role=switch with aria-checked reflecting the on/off state.
  • Pair with a label so the control's purpose is announced.