Toggle

On/off switch with label, description, and two sizes.

Example

Dark mode
Notifications
Receive push notifications
Compact

Props

NameTypeDefaultRequiredDescription
labelstringRequiredAccessible label text
descriptionstringNoHelper text
checkedbooleanNoControlled checked state
defaultCheckedbooleanfalseNoInitial state (uncontrolled)
onChange(checked: boolean) => voidNoCalled when toggled
disabledbooleanNoDisables the toggle
hideLabelbooleanfalseNoVisually hides label
size'sm' | 'md''md'NoToggle size

Accessibility

  • role="switch" with aria-checked
  • Keyboard: Space to toggle
  • Label linked via aria-labelledby

Related Tokens

--toggle-surface--toggle-on-surface--toggle-checked--toggle-gap--toggle-label-font-weight