Skip to content

Manual installation

Configure path aliases

In a React project with application code under src/, add the following mapping to compilerOptions in tsconfig.json. If your application code lives at the project root, use ["./*"] instead.

{
  "paths": {
    "@/*": ["./src/*"]
  }
}

Configure your bundler to resolve the same alias. The framework guides cover Vite and Next.js.

Install a component

Run both commands from the directory that contains package.json. The first installs the editor packages. The second adds the heading button and its dependencies.

npm install @tiptap/react@3 @tiptap/pm@3 @tiptap/starter-kit@3
npx @tiptap/cli@latest add heading-button

Connect the button to an editor

StarterKit provides the heading extension. Pass the same editor instance to HeadingButton and EditorContent so the button updates the selection in that editor.

'use client'

import { EditorContent, useEditor } from '@tiptap/react'
import StarterKit from '@tiptap/starter-kit'
import { HeadingButton } from '@/components/tiptap-ui/heading-button'

export default function Editor() {
  const editor = useEditor({
    extensions: [StarterKit],
    content: '<p>Type a heading here.</p>',
    immediatelyRender: false,
  })

  return (
    <>
      <HeadingButton editor={editor} level={1} />
      <EditorContent editor={editor} />
    </>
  )
}

Configure styles

Load the shared variables and animations in your global stylesheet. Style setup