---
title: "Toolbar"
description: "A row or column of controls, such as the bar of a text editor. Tab reaches it once, and the arrow keys move between its buttons."
url: https://gelatinui.com/components/toolbar
markdown_url: https://gelatinui.com/components/toolbar.md
access: free
install: "npx shadcn@latest add @gelatin-ui/toolbar"
registry_item: https://gelatinui.com/r/toolbar.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Toolbar

> A row or column of controls, such as the bar of a text editor. Tab reaches it once, and the arrow keys move between its buttons.

Page: https://gelatinui.com/components/toolbar

## When to use it

Best for: A row or column of controls with one Tab stop, such as the bar of an editor.

- Use it for controls that belong together. Give it an `aria-label`.
- Put groups of toggles in `ToolbarGroup`.
- Use `orientation="vertical"` for a side rail.

## When not to use it

- For one set of toggles, use a [Toggle Group](https://gelatinui.com/components/toggle-group.md).
- For page navigation, use a [Tabs](https://gelatinui.com/components/tabs.md).

## Notes for agents

- Arrow keys move between items, flipped in right to left. `loopFocus` is on by default.
- Disabled items stay in the arrow-key path, so a person can find them.
- A Toggle or a Select goes in with `ToolbarButton`'s `unstyled`, to keep its own look.
- One text field goes last in the row: Left and Right move its caret, so Tab leaves it.

## Anatomy

```text
Toolbar
├─ ToolbarGroup (0..n)
├─ ToolbarButton (0..n)
├─ ToolbarLink (0..n)
├─ ToolbarInput (0..n)
└─ ToolbarSeparator (0..n)
```

## API reference

### Toolbar

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `variant` | `"outline" \| "plain"` | "outline" |  |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Toolbar.Root`: https://base-ui.com/react/components/toolbar

### ToolbarGroup

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Toolbar.Group`: https://base-ui.com/react/components/toolbar

### ToolbarButton

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` | "sm" |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` | "ghost" |  |
| `className` | `string` |  |  |
| `unstyled` | `boolean` | false | Drop the Button look and keep only `className`. Use it when `render` mounts a component with its own look (a Toggle, a ToggleGroupItem, a SelectTrigger), or the two looks mix. |
| `chevron` | `boolean` | false | Add a chevron after the content, for a button that opens a menu, a select, or a popover with its current value in front ("Heading 1", a list icon, the color "A"). See the JSDoc of `ToolbarButton`. Default `false`. |

Also takes every prop of Base UI `Toolbar.Button`: https://base-ui.com/react/components/toolbar

### ToolbarLink

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` | "sm" |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` | "ghost" |  |
| `className` | `string` |  |  |

### ToolbarInput

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "lg" \| "sm" \| "xs"` | "sm" |  |
| `surface` | `"default" \| "group"` |  |  |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Toolbar.Input`: https://base-ui.com/react/components/toolbar

### ToolbarSeparator

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Toolbar.Separator`: https://base-ui.com/react/components/toolbar

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Toolbar | `toolbar` |  |  |  |
| ToolbarGroup | `toolbar-group` |  |  |  |
| ToolbarButton | `toolbar-button` | `data-popup-open` |  |  |
| ToolbarLink | `toolbar-link` |  |  |  |
| ToolbarInput | `toolbar-input` |  |  |  |
| ToolbarSeparator | `toolbar-separator` |  |  |  |

## Usage

Compose the buttons and give it a name.

```tsx title="format-bar.tsx"
import { Toolbar, ToolbarButton, ToolbarSeparator } from "@/components/ui/toolbar";

export function FormatBar() {
  return (
    <Toolbar aria-label="Text formatting">
      <ToolbarButton>Bold</ToolbarButton>
      <ToolbarButton>Italic</ToolbarButton>
      <ToolbarSeparator />
      <ToolbarButton>Link</ToolbarButton>
    </Toolbar>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/toolbar
```

It adds 17 registry items: 14 files, 2440 lines, and the npm packages `@base-ui/react`, `@phosphor-icons/react`, `clsx`, `tailwind-merge`, `tailwind-variants`.

## Built on

- [Button](https://gelatinui.com/components/button.md)
- [Separator](https://gelatinui.com/components/separator.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Toggle Group](https://gelatinui.com/components/toggle-group.md)
- [Button](https://gelatinui.com/components/button.md)
- [Menu](https://gelatinui.com/components/menu.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | Moves into the bar once, then out of it. |
| Left Arrow, Right Arrow | Moves between items. Up and Down do it when vertical. |
| Home, End | Goes to the first or the last item. |

## Accessibility

Give it an `aria-label`, such as "Text formatting".

One Tab stop for the whole bar. Arrow keys move inside it.

A group with an `aria-label` names itself as the focus enters it.
