Components · Form Controls

Switch

Turns a single setting on or off right away.

Automated a11y scan passing Element: <input type="checkbox" role="switch">

Component Workbench

Switch between the live interactive preview, syntax-highlighted implementation code, copyable AI coding agent prompt, and designer anatomy blueprint.

Switch · Canonical Spec

When to use it

Do

  • Use it for settings that apply immediately.
  • Name the setting, not the action.

Don't

  • Use it in a form that needs saving. Use Checkbox instead.
  • Change the label when the state changes.

Accessibility & Keyboard Interaction

Requirements for using this component accessibly, following the W3C ARIA Authoring Practices Guide.

Interaction / KeyBehavior & Compliance Requirement
Role SwitchDeclares role="switch" so assistive tech announces on/off state.
SpaceToggles switch state.

Tokens

Values update with the current theme.

RoleTokenCurrent value
Active Track--as-semantic-color-interactive-primary
Active Thumb--as-semantic-color-interactive-primary-text
Esc
↑↓ navigateEnter openEsc close