Inputs
Toggle switch
Also calledswitchtoggleon/off switch
A two-state control that turns a setting on or off immediately, like a physical light switch.
How people describe it
- “pill that slides left and right to turn something on or off”
- “on off switch”
- “little round knob on a track”
Good for
- Settings that apply instantly
- Enabling or disabling a feature
What your library calls it
| LIBRARY | CALLS IT |
|---|---|
| shadcn/ui | Switch |
| MUI | Switch |
| Chakra UI | Switch |
| Mantine | Switch |
| Radix UI | Switch |
Accessibility checklist
- Use the switch role with aria-checked
- Support Space (and Enter) to toggle
- Don't rely on color alone to show the state
Try it
Click or press Space. The state is announced as on or off.
Settings
Colors
Pick, eyedrop, or generate a color, then choose Custom under Color above.
Passes AA · 6.9:1
Text color is chosen for you.
Start
End
Prompt
Add an on/off toggle switch with a label. Apply the change instantly.
~18 estimated prompt tokensDetailed: ~60 estimated prompt tokens
Rough estimate for prompt text only; actual counts vary by model and context.
<button role="switch" aria-checked="false" aria-label="Email notifications">
<span class="knob"></span>
</button>Used in
Explore website blueprints that use this component.