Components
Switch
A binary on/off control on Radix Switch — for a setting that takes effect immediately.
A thin styling wrapper over Radix Switch:
the track fills with the brand accent when on. checked/onCheckedChange (or defaultChecked for an
uncontrolled instance) pass straight through.
Implementation notes
- A Switch takes effect immediately — a Checkbox is a pending choice. The distinction that matters: flipping a Switch should apply the setting right away (no separate Save step); a Checkbox inside a form is one field among others, applied only when the form is submitted. Reaching for the wrong one implies the wrong commit model to the user.
Accessibility
- Always pair with a real, associated label (
<Label htmlFor>, as in the example) — the control has no visible text of its own.
Do / Don't
- Do use
Switchfor a standalone setting toggled on its own (notifications on/off, a preview mode) — not as one field inside a larger form that's saved as a batch. - Don't use
Switchfor a mutually-exclusive pair of options (A vs. B) — that'sSegmentedControlor radio buttons; a switch is binary state, not a choice between two named things.