Installation
What the shadcn registry installs, where the files go, and what your project needs.
Just want it running?
The Quick start covers the same steps with less detail. This page explains what each step does.
blockcn is published as a shadcn registry at https://blockcn.com/r. shadcn add copies source files into your repo and installs the npm packages they import, including Tiptap. Nothing is added to your package.json as a blockcn package.
Requirements
| Requirement | Why |
|---|---|
| React 18.3 or 19 | Both are installed and rendered in CI. See Supported stack. |
| Tailwind CSS v4 | The editor styles use v4 utilities and your theme tokens. |
A src/ directory | Every registry file targets src/…. |
The @/* → src/* alias | The source imports @/components/…, @/editor-core/… and @/lib/…. |
| shadcn initialized | Provides the theme CSS variables and src/lib/utils.ts (cn). |
"node" in compilerOptions.types | Vite's tsconfig.app.json lists only vite/client, so process.env.NODE_ENV does not typecheck until you add "node". shadcn init already installs @types/node. |
| npm, pnpm, yarn, or bun, with default settings | Each registry item lists every Tiptap package it needs at 3.29.0, including the ones Tiptap only declares as peers (such as yjs for the drag handle), so shadcn add installs one matching set. No .npmrc changes. Keep those versions when you update other packages; see Supported stack. |
Install
Prepare the project
Use the App Router with TypeScript, Tailwind CSS and src/:
npx create-next-app@latest my-app --typescript --tailwind --app --src-dir --import-alias "@/*"The editor touches the DOM, so you'll render it from a client component with ssr: false (see Basic editor). renderDocument(json) is the server-side path: HTML, no DOM.
Initialize shadcn
npx shadcn@latest initAdd the editor
npx shadcn@latest add https://blockcn.com/r/editor-shell.jsoneditor-shell pulls in its dependencies automatically:
| Item | Contents |
|---|---|
editor-shell | Editor, useEditor, side menu, formatting toolbar, outline, editor.css |
editor-core | Document schema, slash menu, block commands. No React. |
editor-vanilla | mountBlockcnEditor(element) : a DOM toolbar and slash menu for non-React pages. Depends on editor-core only. |
editor-ui | The Radix primitives the editor uses, under components/editor/ui |
Add optional features (any time)
Each add-on is its own registry item. Add the ones you need:
npx shadcn@latest add https://blockcn.com/r/<item>.json| Item | Adds | Docs |
|---|---|---|
table-toolbar | Tables with row and column grips | Blocks |
media-blocks | Image, video, audio, file, embed, and gallery blocks, with uploads | Blocks |
excalidraw-block | Whiteboard block | Blocks |
math | KaTeX block and inline math | Blocks |
columns | 2–5 column layouts | Blocks |
mentions | @ mentions | Mentions recipe |
toc | Table-of-contents block | Blocks |
pages | Links to your app's pages ([[) | Page links |
link-preview | Link, mention, bookmark, or embed for a pasted URL | Link previews |
export-menu | HTML, Markdown, Word, and PDF export; Markdown, HTML, and Word import | Content |
ai-menu | Ask AI panel, slash actions, autocomplete | AI |
collaboration | Real-time editing with Yjs, carets, presence | Collaboration |
comments | Comment threads on text | Comments |
suggestions | Suggesting mode (tracked changes) | Suggestions |
versions | Version history | Version history |
editor-vanilla | mountBlockcnEditor(element) for pages without React | Basic editor |
Each add-on's factory (table(), math(), …) comes from its own item; Custom blocks lists the import paths. Versions and the exact command for every item are on Registry.
Installing a feature only copies its files. It appears in the editor once you register it, which each guide explains.
Mermaid, which the whiteboard uses, imports KaTeX 0.16. The math add-on imports KaTeX 0.19. In Vite, add katex to resolve.dedupe so both resolve to the copy your app installed. The demo does this. Without it, a pnpm install keeps both, about 77 KB gzip each. Mermaid calls renderToString with output: "mathml" or "htmlAndMathml", which 0.19 still supports.
Where the files land
Editor.tsx imports editor.css itself, so you don't need to add a stylesheet.
Updating
Run the same shadcn add command again to pull the latest version. shadcn asks before overwriting each file you've changed, so review the diff with git before accepting.
Next: render the basic editor.