---
title: "Next.js"
description: "Install and configure Tiptap UI Components in your Next.js project."
---

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

# Next.js

Install and configure Tiptap UI Components in your Next.js project.

> **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.

Run the `init` command to create a new Next.js project or to setup an existing one:

```bash
pnpm dlx @tiptap/cli init
```

Choose between a `Next.js` project or a `Monorepo`.

When prompted with:

```bash
Would you like to add a template or UI components to your project?
```

Select **UI Components** if you want to include reusable Tiptap UI components.
Alternatively, select **Template** to scaffold a full example project.

> **Only add styles**
>
> If you added a template or UI components during setup, you can skip this section and proceed
> directly to **Add Styles**.

## Add Tiptap Components

Install Tiptap UI components using the CLI. For example, to add the `HeadingButton` component:

```bash
pnpm dlx @tiptap/cli add heading-button
```

The command above will install the `HeadingButton` component and its dependencies. You can then import and use it in your **Tiptap** project:

```tsx
import { HeadingButton } from '@/components/ui/heading-button'

export default function App() {
  // Tiptap ...

  return (
    <>
      <HeadingButton level={1}>Heading 1</HeadingButton>
      <HeadingButton level={2}>Heading 2</HeadingButton>
      <HeadingButton level={3}>Heading 3</HeadingButton>
    </>
  )
}
```

## Add Styles

To enable support for SCSS, install the SCSS compiler:

```bash
pnpm add -D sass
```

Then, to ensure the component and editor have the correct variables and animations, manually import the SCSS partials into your main stylesheet `global.css`:

```css
@import 'path-to/styles/_variables.scss';
@import 'path-to/styles/_keyframe-animations.scss';
```
