Toggle Group
stableA set of two-state buttons that can be single or multiple select.
Basic usage
Examples
Single selection (alignment)
Use type="single" for mutually exclusive choices like text alignment.
Alignment: left
Single and multiple groups
Use type="single" for mutually exclusive choices and type="multiple" for toolbars.
Features
- Single or multiple selection.
- Roving focus navigation.
Installation
bash
pnpm dlx structyl add toggle-groupAPI Reference
ToggleGroup.Root
A group of toggles.
| Prop | Type | Default |
|---|---|---|
| type | 'single' | 'multiple'Selection mode. | — |
| value | string | string[]Controlled value. | — |
| onValueChange | (value) => voidCalled when selection changes. | — |
| disabled | booleanDisable the whole group. | — |
ToggleGroup.Item
A single toggle.
| Prop | Type | Default |
|---|---|---|
| value | stringThe item value. | — |
| disabled | booleanDisable the item. | — |