A container for grouping a set of controls, such as buttons, toggle groups or dropdown menus.
Full keyboard navigation.
Install the component from your command line.
npm install @radix-ui/react-toolbar
Import the component.
import * as Toolbar from '@radix-ui/react-toolbar';
export default () => (
<Toolbar.Root>
<Toolbar.Button />
<Toolbar.Separator />
<Toolbar.Link />
<Toolbar.ToggleGroup>
<Toolbar.ToggleItem />
</Toolbar.ToggleGroup>
</Toolbar.Root>
);
Contains all the toolbar component parts.
A button item.
A link item.
A set of two-state buttons that can be toggled on or off.
An item in the group.
Used to visually separate items in the toolbar.
All our primitives which expose a Trigger
part, such as Dialog
, AlertDialog
, Popover
, DropdownMenu
can be composed within a toolbar by using the asChild
prop.
Here is an example using our DropdownMenu
primitive.
import * as Toolbar from '@radix-ui/react-toolbar';
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
export default () => (
<Toolbar.Root>
<Toolbar.Button>Action 1</Toolbar.Button>
<Toolbar.Separator />
<DropdownMenu.Root>
<Toolbar.Button asChild>
<DropdownMenu.Trigger>Trigger</DropdownMenu.Trigger>
</Toolbar.Button>
<DropdownMenu.Content>…</DropdownMenu.Content>
</DropdownMenu.Root>
</Toolbar.Root>
);
Uses roving tabindex to manage focus movement among items.