① Track
Rounded pill — fills with brand color when on
② Thumb
White circle that slides to indicate state
③ Label
Optional — describes the setting being controlled
Interactive previews with copy-ready code snippets. Toggles apply changes immediately — no submit action required.
Off and on states side by side. The track color changes from zinc to brand to communicate state clearly.
A label to the right describes the setting being controlled. Click to toggle.
SM toggle (w-8 h-5) for compact contexts such as table rows or inline settings. MD (w-10 h-6) is the default.
Disabled toggles cannot be interacted with. Show both off and on disabled states so the current value is still visible.
A real-world settings panel pattern — three independent toggles each controlling a distinct preference. Click any toggle to switch it.
Settings
Email notifications
Receive updates and alerts via email
Dark mode
Switch between light and dark interface
Two-factor auth
Add an extra layer of account security
① Track
Rounded pill — fills with brand color when on
② Thumb
White circle that slides to indicate state
③ Label
Optional — describes the setting being controlled
| Token | Value | Description |
|---|---|---|
background/brand/primary | #318272 | Track fill when on |
background/subtle | #d4d4d8 | Track fill when off |
background/surface | #ffffff | Thumb fill |
text/primary | #111827 | Label text |
focus/ring | #5eead4 | Focus ring around track |
| Prop | Type | Default | Description |
|---|---|---|---|
on | boolean | false | Controlled on/off state. |
state | "default" | "hover" | "focus" | "disabled" | "default" | Visual interaction state. |
label | string | — | Optional label describing the setting controlled by this toggle. |
size | "sm" | "md" | "md" | sm=(w-8 h-5) · md=(w-10 h-6). |
onChange | (on: boolean) => void | — | Called with the new boolean state on click. |
Do
Don't