---
title: "Add a toolbar UI component into Tiptap"
description: "Organize actions and controls in a horizontal or vertical container. More in the docs!"
---

> This page is for Tiptap 2.x. [See the latest version of this page.](https://tiptap.dev/docs/ui-components/primitives/toolbar.md)

# Add a toolbar UI component into Tiptap

Organize actions and controls in a horizontal or vertical container. More in the docs!

> **Upgrade to v3**
>
> To use UI components or templates you need to upgrade to Editor version 3.x. See the [upgrade
> guide](https://tiptap.dev/docs/resources/whats-new) for more details.

A container for organizing actions and controls in a horizontal or vertical layout.

> **Interactive demo:** [toolbar](https://template.tiptap.dev/preview/tiptap-ui-primitive/toolbar)

## Install

You can add the primitive via Tiptap CLI (for Vite or Next.js)

```bash
npx @tiptap/cli add toolbar
```

### Manual Integration

For frameworks other than Vite or Next.js, add the primitive manually from the [open-source repository](https://github.com/ueberdosis/tiptap-ui-components/tree/main/apps/web/src/components/tiptap-ui-primitive/toolbar).

### Import styles

This component requires you to import our styles which were added to `styles/keyframe-animation.scss` and `styles/_variables.scss`.

## Usage

```tsx
import { Toolbar, ToolbarGroup, ToolbarSeparator } from '@/components/tiptap-ui-primitive/toolbar'
import { Button } from '@/components/tiptap-ui-primitive/button'
import { BoldIcon } from '@/components/icons/bold-icon'
import { ItalicIcon } from '@/components/icons/italic-icon'
import { Spacer } from '@/components/tiptap-ui-primitive/spacer'

export default function MyComponent() {
  return (
    <Toolbar variant="default">
      <ToolbarGroup>
        <Button data-style="ghost">
          <BoldIcon className="tiptap-button-icon" />
        </Button>
        <Button data-style="ghost">
          <ItalicIcon className="tiptap-button-icon" />
        </Button>
      </ToolbarGroup>

      <ToolbarSeparator />

      <ToolbarGroup>
        <Button data-style="ghost">Format</Button>
      </ToolbarGroup>

      <Spacer />

      <ToolbarGroup>
        <Button data-style="primary">Save</Button>
      </ToolbarGroup>
    </Toolbar>
  )
}
```

## Props

### Toolbar

| Name       | Type                    | Default   | Description                  |
| ---------- | ----------------------- | --------- | ---------------------------- |
| variant    | 'default' \| 'floating' | 'default' | Toolbar style variant        |
| data-plain | boolean                 | undefined | Whether to use plain styling |

### ToolbarSeparator

| Name        | Type                       | Default    | Description                  |
| ----------- | -------------------------- | ---------- | ---------------------------- |
| orientation | 'horizontal' \| 'vertical' | 'vertical' | Orientation of the separator |
