Toolbar
Group of controls with one tab stop and arrow-key navigation.
- Browsers
- Chrome 123+Firefox 121+Safari 17.5+
- Tier
- 1
- Bundle compressed
- 2.04 kB
- Forced layout budget
- 0 ms
- Axe budget
- 0
- SSR compatible
- Yes
- Published contract
- Test harness
Playground
Toolbar
Default
API
Toolbar.Root
| Prop | Type | Default | Description |
|---|---|---|---|
dir | "ltr" | "rtl" | — | Writing direction, which flips what the left and right arrow keys do. |
loop | boolean | true | Whether arrow-key navigation wraps around at the first and last item. |
orientation | "horizontal" | "vertical" | "both" | "horizontal" | Which arrow keys move focus between items, and the data-orientation value. |
Toolbar.Button
| Prop | Type | Default | Description |
|---|---|---|---|
selected | boolean | — | Toggle state of the button: sets aria-pressed and, when true, data-selected and the primary fill. |
children | ReactNode | — | Content of the button. |
className | string | — | Class applied to the button element. |
disabled | boolean | false | Disables the button and takes it out of the roving-focus order. |
Toolbar.Link
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Content of the link. |
className | string | — | Class applied to the anchor element. |
href* | string | — | Destination of the link, which navigates without JavaScript. |
Toolbar.Separator
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Class applied to the <hr> element. |
orientation | "horizontal" | "vertical" | "vertical" | Sets aria-orientation and data-orientation on the separator. |
Toolbar.ToggleGroup
| Prop | Type | Default | Description |
|---|---|---|---|
id* | string | — | Base for the deterministic ids and the shared input group name. |
type | "single" | "multiple" | "single" | Whether one or several toggles may be pressed, choosing radio or checkbox inputs. |
items* | readonly ToggleGroupItem[] | — | Each item is { value, label, disabled? }. |
defaultValue | string | readonly string[] | undefined | — | Pressed on first render. Uncontrolled, so it survives with no JavaScript. |
orientation | "horizontal" | "vertical" | "horizontal" | Direction the toggles are laid out in. |
className | string | — | Class applied to the group root. |
Keyboard
| Key | Action |
|---|---|
| Tab | Move focus to/from the control |
| Enter / Space | Activate when focused (button-like controls) |
Accessibility
Uses semantic HTML where possible. Inspect rendered markup in the playground — ARIA is added only when native elements are insufficient.
Styling hooks
data-disabled