> ## Documentation Index
> Fetch the complete documentation index at: https://npm-packages.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Slash commands

> Insert a heading, list, task, quote, or code block from the keyboard.

Package: [`@tiptap/react`](https://www.npmjs.com/package/@tiptap/react).

## Try it

Click the empty line and type `/`. Keep typing to filter: try `/heading`, `/todo`, or `/quote`. Use the arrow keys and Enter to insert a block, or click a result.

## Commands

The menu calls Tiptap commands after removing the slash query. This small menu is custom to the example; it uses Tiptap's public extension and ProseMirror APIs.

```tsx block-commands.ts theme={"theme":{"light":"github-light","dark":"github-dark"}}
import type { Editor } from "@tiptap/core";

export function insertHeading(
  editor: Editor,
  range: { from: number; to: number },
) {
  editor
    .chain()
    .focus()
    .deleteRange(range)
    .setHeading({ level: 2 })
    .run();
}

export function insertTaskList(
  editor: Editor,
  range: { from: number; to: number },
) {
  editor
    .chain()
    .focus()
    .deleteRange(range)
    .toggleTaskList()
    .run();
}
```

## Keyboard

| Key | Action |
| - | - |
| `/` at the start of an empty paragraph | Open the menu |
| Text after `/` | Filter block types |
| `↑` / `↓` | Move through results |
| `Enter` | Insert the selected block |
| `Escape` | Close the menu and keep your text |

An ordinary slash inside a sentence stays text. The menu does not open inside code blocks and closes when you leave the editor.

[Command chaining](https://tiptap.dev/docs/editor/api/commands) · [Document editor](https://npm-packages.mintlify.site/tiptap/editor.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.