A versatile Switch, managing state, context, and styling.
Anatomy
<Switch.Root>
<Switch.Label />
</Switch.Root>Examples
Variants
Switch components come with three built in variants, solid, outlined, and muted.
Label Positions
The label element <label> is available in the switch component anatomy. If included it can be easily positioned with the position prop.
Sizes
To manage the size of the switch component you can provide a default or custom size through the size prop.
Colors
The switch component uses the color prop to allow for predefined and custom colors.
Alignments
To set alignment of the switch and its label content you can use the align prop.
States
Switches can be given the disabled, readonly, and defaultChecked states.