Switch

Form

A toggle switch for binary on/off settings.

Playground

Controls

Switch label.

On/off state.

Size.

Disabled state.

Props

PropTypeDefaultDescription
modelValuebooleanfalseSwitch state.
labelstringText label.
descriptionstringHelper text.
size'sm' | 'md''md'Size.
disabledbooleanfalseDisabled state.

Examples

Off
vue
<DsSwitch
  label="Dark mode"
  :modelValue="false"
/>
On
vue
<DsSwitch
  label="Dark mode"
  modelValue
/>
Small
vue
<DsSwitch
  label="Small toggle"
  :modelValue="false"
  size="sm"
/>
Disabled
vue
<DsSwitch
  label="Unavailable"
  disabled
/>

Skeleton

Use DsSwitchSkeleton as a loading placeholder while content is being fetched.

Small
vue
<DsSwitchSkeleton
  size="sm"
  showLabel
/>
Medium
vue
<DsSwitchSkeleton
  size="md"
  showLabel
/>
No label
vue
<DsSwitchSkeleton :showLabel="false" />

Accessibility

  • Uses role="switch" with aria-checked.
  • Keyboard-operable: Space to toggle.