Toggle

A button with a pressed / not-pressed state — for inline formatting and similar on/off affordances. Controlled (pressed + onPressedChange) or uncontrolled (defaultPressed).

Sizes

size scales the padding, text and icon together — sm, base (default), lg.

ToggleButtons (segmented)

ToggleButtons is a single-select segmented control: a sliding highlight animates to the active ToggleButton. Drive it with value + onValueChange.

Props

Toggle

PropTypeDefaultDescription
pressedbooleanControlled state. Omit for uncontrolled.
defaultPressedbooleanfalseInitial state when uncontrolled.
onPressedChange(pressed: boolean) => voidFired on toggle.
variant'primary' | 'secondary''primary'Active fill style.
size'sm' | 'base' | 'lg''base'Padding/text scale.

ToggleButtons / ToggleButton

PropTypeDefaultDescription
valuestringSelected value (ToggleButtons).
onValueChange(value: string) => voidFired on select.
variant'primary' | 'secondary' | 'ghost''primary'Highlight style.
size'sm' | 'md' | 'lg''md'Item size.
paddingbooleantrueFrame padding around the segments. Set false for a tighter, edge-to-edge group.
value (item)stringThis button's value.
icon (item)booleanfalseSquare icon-only sizing.
asChild (item)booleanfalseRender the single child instead of a <button>, forwarding the ref, selected state, and click.