Switch
A toggle that turns a single setting on or off, its track filled with the action colour while on and named by the label tied to it.
Usage
Examples
Sizes
size sets the track and its thumb: sm 9px, base 12px (the default) or lg 16px thumbs, each on a track two thumbs wide.
Border radius
borderRadius sets the track's corners on the kit's one scale: none, xs 4px, sm 6px, base 8px, lg 12px, xl 16px, or full, the default, to round it, the thumb following one step inside; no corner rounds past half the track's height.
Disabled
disabled dims the switch and its label and ignores clicks, beside one as it is by default.
Invalid
error writes what is wrong under the switch and its label, rings the track in the destructive colour and describes it to screen readers, beside one without an error.
API Reference
Switch
SwitchProps · components/Switch/Switch.types.tsIt also takes the props of Radix Switch.Root.