blockcn

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

RequirementWhy
React 18.3 or 19Both are installed and rendered in CI. See Supported stack.
Tailwind CSS v4The editor styles use v4 utilities and your theme tokens.
A src/ directoryEvery registry file targets src/….
The @/* → src/* aliasThe source imports @/components/…, @/editor-core/… and @/lib/….
shadcn initializedProvides the theme CSS variables and src/lib/utils.ts (cn).
"node" in compilerOptions.typesVite'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 settingsEach 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 init

Add the editor

npx shadcn@latest add https://blockcn.com/r/editor-shell.json

editor-shell pulls in its dependencies automatically:

ItemContents
editor-shellEditor, useEditor, side menu, formatting toolbar, outline, editor.css
editor-coreDocument schema, slash menu, block commands. No React.
editor-vanillamountBlockcnEditor(element) : a DOM toolbar and slash menu for non-React pages. Depends on editor-core only.
editor-uiThe 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
ItemAddsDocs
table-toolbarTables with row and column gripsBlocks
media-blocksImage, video, audio, file, embed, and gallery blocks, with uploadsBlocks
excalidraw-blockWhiteboard blockBlocks
mathKaTeX block and inline mathBlocks
columns2–5 column layoutsBlocks
mentions@ mentionsMentions recipe
tocTable-of-contents blockBlocks
pagesLinks to your app's pages ([[)Page links
link-previewLink, mention, bookmark, or embed for a pasted URLLink previews
export-menuHTML, Markdown, Word, and PDF export; Markdown, HTML, and Word importContent
ai-menuAsk AI panel, slash actions, autocompleteAI
collaborationReal-time editing with Yjs, carets, presenceCollaboration
commentsComment threads on textComments
suggestionsSuggesting mode (tracked changes)Suggestions
versionsVersion historyVersion history
editor-vanillamountBlockcnEditor(element) for pages without ReactBasic 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

context.tsx
Editor.tsx
useEditor.ts
editor.css

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.

On this page