Toolbar
Accessible toolbar with toggle groups and roving tabindex keyboard navigation
Source
LLM docs
Docs
Package
Usage
Toolbar is a group of toggle buttons with role="toolbar" and arrow keys navigation.
Toolbar.Toggle is a polymorphic component, it can be rendered as any element, for example
as a link.
Toolbar.Toggle is stateless: pass active and update it in onClick, or use Toolbar.ToggleGroup
to manage state of a set of toggles. For a toggle that manages its own state, use the standalone
Toggle component.
Toggle groups
Use Toolbar.ToggleGroup with Toolbar.ToggleItem to create groups of toggle buttons.
Set type="single" to allow one active item at a time or type="multiple" to allow several.
With type="single", clicking the active item deselects it and the value becomes null.
Size, orientation, variant and color
The size prop controls the size of all toggles, padding and gap.
Set orientation="vertical" to render a vertical toolbar. variant and color
props control the appearance of active toggles.
Auto contrast
Set autoContrast prop to automatically adjust icon color based on the active toggle
background color, for example with variant="filled" and light colors.
Auto width
By default, Toolbar.Toggle and Toolbar.ToggleItem render as square buttons. Set autoWidth
prop on either of them to allow the toggle width to adjust to its content, for example a text label.
Disabled state
Set disabled prop on individual Toolbar.ToggleItem components, or on
Toolbar.ToggleGroup to disable all items within the group.
When Toolbar.Toggle is rendered as a non-button element (for example, component="a"), the disabled prop
sets aria-disabled, removes the element from the tab order and prevents clicks.
Accessibility
Toolbarhasrole="toolbar"andaria-orientationthat matches theorientationpropToolbar.ToggleItemalways hasaria-pressedattribute.Toolbar.Togglehas it only when theactiveprop is passed, without itToolbar.Toggleis a regular button- Set
aria-labelon icon-only toggles
Keyboard interactions
Toolbar.Toggle and Toolbar.ToggleItem components share a single tab stop, arrow keys move focus
between them. Other interactive children (ActionIcon, Button, standalone Toggle) are not part
of the arrow key navigation and remain separate tab stops.