Switch
stableA control that allows the user to toggle between checked and not checked.
Basic usage
Examples
Controlled toggle
Track the checked state externally to drive other UI.
Status: disabled
Settings list
Use controlled or uncontrolled switches inside dense settings panels.
Release preferences
Realistic app composition
Semantic colors
Switch accepts a color prop to match the semantic context of the toggle.
Features
- Full keyboard navigation.
- Can be controlled or uncontrolled.
- iOS-style spring thumb animation.
Installation
bash
pnpm dlx structyl add switchAPI Reference
Switch API reference
Full props, types, defaults.
Keyboard interactions
Adheres to the WAI-ARIA design pattern .
| Key | Description |
|---|---|
| Space / Enter | Toggles the switch. |