Overview
Toolbar provides a container for grouping related controls like buttons, toggle buttons, dropdown menus, and links. It supports keyboard navigation and proper focus management.Features
- Full keyboard navigation
- Supports horizontal/vertical orientation
- Flexible layout support
- Can contain buttons, links, separators, and toggle groups
- Focus management with roving tabindex
- Proper ARIA attributes for accessibility
Installation
Anatomy
API Reference
Root
Contains all the toolbar component parts.The orientation of the toolbar.
The reading direction of the toolbar. If omitted, inherits from the parent.
When true, keyboard navigation will loop from last item to first, and vice versa.
Change the default rendered element for the one passed as a child.
Button
A button item.When true, prevents the user from interacting with the button.
Change the default rendered element for the one passed as a child.
Link
A link item.Change the default rendered element for the one passed as a child.
ToggleGroup
A set of two-state buttons that can be toggled on or off.Determines whether a single or multiple items can be pressed at a time.
type="single":
The controlled value of the pressed item.
The value of the item to show as pressed when initially rendered (uncontrolled).
Event handler called when the pressed state changes.
type="multiple":
The controlled value of the pressed items.
The values of the items to show as pressed when initially rendered (uncontrolled).
Event handler called when the pressed state changes.
When true, prevents the user from interacting with the toggle group and all its items.
When false, prevents automatic focus cycling through items.
The orientation of the component.
The reading direction of the toggle group.
When loop and rovingFocus are true, keyboard navigation will loop.
ToggleItem
An item in the toggle group.A unique value for the item.
When true, prevents the user from interacting with the item.
Change the default rendered element for the one passed as a child.
Separator
Used to visually separate items in the toolbar.Change the default rendered element for the one passed as a child.
Example
Accessibility
Uses roving tabindex to manage focus movement among items.
Keyboard Interactions
- Tab - Moves focus to the first item in the toolbar.
- ArrowRight - Moves focus to the next item in the toolbar (in horizontal orientation).
- ArrowLeft - Moves focus to the previous item in the toolbar (in horizontal orientation).
- ArrowDown - Moves focus to the next item in the toolbar (in vertical orientation).
- ArrowUp - Moves focus to the previous item in the toolbar (in vertical orientation).
- Home - Moves focus to the first item.
- End - Moves focus to the last item.