Switch
Toggle switch for binary settings, with role=switch and aria-checked.
npx @slipstream-ui/cli@latest add switchStates
Settings rows
Product news and digests
Mentions and direct messages
Play a tone for new messages
Visible to your team
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| checked | boolean | — | Controlled on/off state. |
| defaultChecked | boolean | false | Initial state when uncontrolled. |
| onCheckedChange | (checked: boolean) => void | — | Fired when the user toggles the switch. |
| disabled | boolean | false | Disables the switch. |
| aria-label | string | — | Accessible name when no visible label is associated. |
Accessibility
- role="switch" with aria-checked announces on/off state.
- Space and Enter toggle the switch.
- Disabled switches are focusable-but-inert per native button semantics and announced as dimmed.
- Prefer a visible <Label> (htmlFor) over aria-label when space allows.
Browser support
| Browser | Tested versions |
|---|---|
| Chrome | 111+ (Mar 2023) |
| Edge | 111+ (Mar 2023) |
| Firefox | 121+ (Dec 2023) |
| Safari | 17.2+ — macOS & iOS (Dec 2023) |
Slipstream components rely only on CSS custom properties, Flexbox/Grid, and ARIA — the everyday baseline of the last two years of evergreen releases. Anything newer is progressive enhancement: unsupported browsers keep full functionality with static behavior instead of animations.