Actions
Toggle & segmented
Pressable toggles and a gliding segmented control.
Segmented control
A radio-like choice between a few views. One highlight glides to the selected option. The arrow keys move and select.
Team plan: $24 / month
When to use
SegmentedControl: switching a view or setting, exactly one always selected (billing period, List / Board, Day / Week).Toggle: one on/off state that applies immediately (Bold, Pin, Mute).ToggleGroup: a toolbar of related toggles, one pressed or several (formatting, alignment).- Not for navigating between pages (use tabs or links) or for form settings that need Save (use a switch or radio group).
Sizes and icons
Toggle
A button with aria-pressed. ghost is transparent until pressed, outline adds a border. Controlled with pressed, or uncontrolled with defaultPressed.
Toggle group
type="multiple" allows several pressed items, type="single" at most one. The group is one tab stop; arrows move between items.
bold · aligned left
API
Toggle
| Prop | Type | Default | Description |
|---|---|---|---|
| pressed / defaultPressed | boolean | — | Pressed state, controlled or initial. |
| onPressedChange | (pressed: boolean) => void | — | Called when toggled. |
| variant | 'ghost' | 'outline' | 'ghost' | Visual style. |
| size | 'sm' | 'md' | 'lg' | 'md' | Height 32 / 36 / 44px. |
| icon | boolean | — | Square icon-only. Needs aria-label. |
ToggleGroup
| Prop | Type | Default | Description |
|---|---|---|---|
| type | 'single' | 'multiple' | 'single' | How many items can be pressed. |
| value / defaultValue | string | string[] | — | Pressed item value(s); '' means none in single mode. |
| onValueChange | (value) => void | — | Called when the pressed set changes. |
| variant / size / disabled | same as Toggle | — | Applied to every item. Outline joins items into one bar. |
| orientation | 'horizontal' | 'vertical' | 'horizontal' | Which arrow keys move focus. |
SegmentedControl
| Prop | Type | Default | Description |
|---|---|---|---|
| value / defaultValue | string | — | Selected item value. |
| onValueChange | (value: string) => void | — | Called when the selection changes. |
| size | 'sm' | 'md' | 'lg' | 'md' | Height 32 / 36 / 44px. |
| fullWidth | boolean | — | Stretch; items share the width equally. |
| name | string | — | Submits the value with a form (hidden input). |
| disabled | boolean | — | Disable all items; each SegmentedControlItem also takes disabled. |
Keyboard
| Key | Action |
|---|---|
| Tab | Into the group: lands on the selected / pressed item, else the first. |
| Arrow keys / Home / End | Toggle group: move focus. Segmented control: move focus and select. |
| Space / Enter | Toggle: press or release the focused item. |
Accessibility
- Toggle and ToggleGroup items are buttons with aria-pressed inside role="group": name the group with aria-label.
- SegmentedControl is a radiogroup: role="radio" with aria-checked and a roving tabindex (WAI-ARIA radio group).
- Icon-only items need an aria-label.
Motion
- The segmented pill glides on the morph spring (about 550ms) and resizes to the new label. It is measured, positioned with CSS variables and does not animate on first render.
- Toggles press to .97 on the snappy spring; colours cross-fade in 150ms.
- Reduced motion: the pill jumps, states still change.