Toggle
A two-state button that is either on or off, solid and off by default.
Usage
Examples
Appearances
appearance paints the toggle on the kit's one scale, as a field is: solid, the default, soft on the grey wash, outline with only its line, and transparent with neither until it is hovered or pressed.
Sizes
size sets the height at a Button's heights, xs, sm, base (the default) or lg, with a matching least width, so a toggle holding only an icon is square at each of them.
Border radius
borderRadius sets the corners as a Button's, on the kit's one scale: none, xs 4px, sm 6px, base 8px, lg 12px, xl 16px, or full to round it, which makes a toggle holding only an icon a circle; base is the default.
With icon
An icon goes in as a child beside the words, and data-icon="inline-start" or "inline-end" trims the padding on its side.
Icon only
An icon alone makes the toggle square at every size, and aria-label names it for a screen reader.
Pressed
defaultPressed, or pressed with onPressedChange, turns the toggle on, beside one off as it is by default.
Disabled
disabled dims the toggle and holds off clicks and the keyboard, beside one as it is by default.
API Reference
Toggle
ToggleProps · components/Toggle/Toggle.types.tsIt also takes the props of Radix Toggle.Root.