Toggle group
A row of toggles: one choice (day, week, month) or several (bold, italic). Arrow keys move between them.
Installation
Or with the shadcn CLI, from the registry:
It installs Toggle too.
Usage
Several at once
By default one item is pressed at a time. Pass multiple to let several be pressed, as for text styles. The value is
always an array.
Variants and sizes
variant (default, outline or soft) and size (sm, default, lg) on the group apply to every item, as on
Toggle; an item can set its own.
Villages
The outline variant draws one bordered control with dividers between its items, in the village's radius and border width.
Accessibility
- A group of
aria-pressedbuttons: name it witharia-label. - Tab enters the group once; arrow keys move between items, Space presses one.
API reference
The parts of Base UI's Toggle Group:
| Part | Notes |
|---|---|
ToggleGroup | value, defaultValue, onValueChange, multiple, orientation, disabled; variant and size for every item |
ToggleGroupItem | value, disabled; variant and size override the group's |