---
title: "Select a heading from a menu"
description: "Integrate a dropdown menu from which you can select a heading. Add this UI component to your Editor."
---

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

# Select a heading from a menu

Integrate a dropdown menu from which you can select a heading. Add this UI component to your Editor.

> **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 dropdown menu for selecting from multiple heading levels.

> **Interactive demo:** [heading dropdown menu](https://template.tiptap.dev/preview/tiptap-ui/heading-dropdown-menu)

## Install

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

```bash
npx @tiptap/cli add heading-dropdown-menu
```

### Manual Integration

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

### 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 { EditorContent, EditorContext, useEditor } from '@tiptap/react'
import { StarterKit } from '@tiptap/starter-kit'
import { HeadingDropdownMenu } from '@/components/tiptap-ui/heading-dropdown-menu'

import '@/components/tiptap-node/paragraph-node/paragraph-node.scss'

export default function MyEditor() {
  const editor = useEditor({
    immediatelyRender: false,
    extensions: [StarterKit],
    content: `
          <h1>Heading 1</h1>
          <p>This is a paragraph of text.</p>
          <h2>Heading 2</h2>
          <p>This is another paragraph of text.</p>
        `,
  })

  return (
    <EditorContext.Provider value={{ editor }}>
      <div className="tiptap-button-group" data-orientation="horizontal">
        <HeadingDropdownMenu levels={[1, 2, 3, 4]} />
      </div>

      <EditorContent editor={editor} role="presentation" />
    </EditorContext.Provider>
  )
}
```

## Props

| Name                | Type                                | Default            | Description                                   |
| ------------------- | ----------------------------------- | ------------------ | --------------------------------------------- |
| editor              | Editor \| null                      | null               | The Tiptap editor instance                    |
| levels              | `Array<1 \| 2 \| 3 \| 4 \| 5 \| 6>` | [1, 2, 3, 4, 5, 6] | The heading levels to include in the dropdown |
| hideWhenUnavailable | boolean                             | false              | Whether the menu is in a floating context     |
| onOpenChange        | (isOpen: boolean) => void           | -                  | Callback when dropdown open state changes     |

## Requirements

Used reference components

- `use-tiptap-editor` (hook)
- `tiptap-utils` (lib)
- `heading-button` (ui)
- `button` (primitive)
- `dropdown-menu` (primitive)
- `chevron-down-icon` (icon)
- `heading-icon` (icon)
