File: toolbar.md | Updated: 11/15/2025
ThemesThemes PrimitivesPrimitives IconsIcons ColorsColors
Documentation Case studies Blog
Search
/
Introduction Getting started Accessibility Releases
Styling Animation Composition Server-side rendering
Accordion
Alert Dialog
Aspect Ratio
Avatar
Checkbox
Collapsible
Context Menu
Dialog
Dropdown Menu
Form
Preview
Hover Card
Label
Menubar
Navigation Menu
One-Time Password Field
Preview
Password Toggle Field
Preview
Popover
Progress
Radio Group
Scroll Area
Select
Separator
Slider
Switch
Tabs
Toast
Toggle
Toggle Group
Toolbar
Tooltip
Accessible Icon Direction Provider Portal Slot Visually Hidden
Components
A container for grouping a set of controls, such as buttons, toggle groups or dropdown menus.
Edited 2 hours ago Share
index.jsxindex.jsxstyles.cssstyles.css
CSS
import * as React from "react";
import { Toolbar } from "radix-ui";
import {
StrikethroughIcon,
TextAlignLeftIcon,
TextAlignCenterIcon,
TextAlignRightIcon,
FontBoldIcon,
FontItalicIcon,
} from "@radix-ui/react-icons";
import "./styles.css";
const ToolbarDemo = () => (
<Toolbar.Root className="ToolbarRoot" aria-label="Formatting options">
<Toolbar.ToggleGroup type="multiple" aria-label="Text formatting">
<Toolbar.ToggleItem
className="ToolbarToggleItem"
value="bold"
aria-label="Bold"
>
<FontBoldIcon />
</Toolbar.ToggleItem>
<Toolbar.ToggleItem
className="ToolbarToggleItem"
value="italic"
aria-label="Italic"
>
<FontItalicIcon />
</Toolbar.ToggleItem>
<Toolbar.ToggleItem
className="ToolbarToggleItem"
value="strikethrough"
aria-label="Strike through"
>
<StrikethroughIcon />
</Toolbar.ToggleItem>
</Toolbar.ToggleGroup>
<Toolbar.Separator className="ToolbarSeparator" />
<Toolbar.ToggleGroup
type="single"
defaultValue="center"
aria-label="Text alignment"
>
<Toolbar.ToggleItem
className="ToolbarToggleItem"
value="left"
aria-label="Left aligned"
>
<TextAlignLeftIcon />
</Toolbar.ToggleItem>
<Toolbar.ToggleItem
className="ToolbarToggleItem"
value="center"
aria-label="Center aligned"
>
<TextAlignCenterIcon />
</Toolbar.ToggleItem>
<Toolbar.ToggleItem
className="ToolbarToggleItem"
value="right"
aria-label="Right aligned"
>
<TextAlignRightIcon />
</Toolbar.ToggleItem>
</Toolbar.ToggleGroup>
<Toolbar.Separator className="ToolbarSeparator" />
<Toolbar.Link
className="ToolbarLink"
href="#"
target="_blank"
style={{ marginRight: 10 }}
>
Edited 2 hours ago
</Toolbar.Link>
<Toolbar.Button className="ToolbarButton" style={{ marginLeft: "auto" }}>
Share
</Toolbar.Button>
</Toolbar.Root>
);
export default ToolbarDemo;
Full keyboard navigation.
Install the component from your command line.
npm install @radix-ui/react-toolbar
Import the component.
import { Toolbar } from "radix-ui";
export default () => (
<Toolbar.Root>
<Toolbar.Button />
<Toolbar.Separator />
<Toolbar.Link />
<Toolbar.ToggleGroup>
<Toolbar.ToggleItem />
</Toolbar.ToggleGroup>
</Toolbar.Root>
);
Contains all the toolbar component parts.
| Prop | Type | Default |
| --- | --- | --- |
| asChild<br><br>Prop description | boolean | false |
| orientation<br><br>Prop description | enum<br><br>See full type | "horizontal" |
| dir<br><br>Prop description | enum<br><br>See full type | No default value |
| loop<br><br>Prop description | boolean | true |
| Data attribute | Values |
| --- | --- |
| [data-orientation] | "vertical" \| "horizontal" |
A button item.
| Prop | Type | Default |
| --- | --- | --- |
| asChild<br><br>Prop description | boolean | false |
| Data attribute | Values |
| --- | --- |
| [data-orientation] | "vertical" \| "horizontal" |
A link item.
| Prop | Type | Default |
| --- | --- | --- |
| asChild<br><br>Prop description | boolean | false |
A set of two-state buttons that can be toggled on or off.
| Prop | Type | Default |
| --- | --- | --- |
| asChild<br><br>Prop description | boolean | false |
| type*<br><br>Prop description | enum<br><br>See full type | No default value |
| value<br><br>Prop description | string | No default value |
| defaultValue<br><br>Prop description | string | No default value |
| onValueChange<br><br>Prop description | function<br><br>See full type | No default value |
| value<br><br>Prop description | string[] | [] |
| defaultValue<br><br>Prop description | string[] | [] |
| onValueChange<br><br>Prop description | function<br><br>See full type | No default value |
| disabled<br><br>Prop description | boolean | false |
| Data attribute | Values |
| --- | --- |
| [data-orientation] | "vertical" \| "horizontal" |
An item in the group.
| Prop | Type | Default |
| --- | --- | --- |
| asChild<br><br>Prop description | boolean | false |
| value*<br><br>Prop description | string | No default value |
| disabled<br><br>Prop description | boolean | No default value |
| Data attribute | Values |
| --- | --- |
| [data-state] | "on" \| "off" |
| [data-disabled] | Present when disabled |
| [data-orientation] | "vertical" \| "horizontal" |
Used to visually separate items in the toolbar.
| Prop | Type | Default |
| --- | --- | --- |
| asChild<br><br>Prop description | boolean | false |
| Data attribute | Values |
| --- | --- |
| [data-orientation] | "vertical" \| "horizontal" |
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 { Toolbar, DropdownMenu } from "radix-ui";
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.
| Key | Description |
| --- | --- |
| Tab | Moves focus to the first item in the group. |
| Space | Activates/deactivates the item. |
| Enter | Activates/deactivates the item. |
| ArrowDown | Moves focus to the next item depending on orientation. |
| ArrowRight | Moves focus to the next item depending on orientation. |
| ArrowUp | Moves focus to the previous item depending on orientation. |
| ArrowLeft | Moves focus to the previous item depending on orientation. |
| Home | Moves focus to the first item. |
| End | Moves focus to the last item. |
PreviousToggle Group
NextTooltip