Both packages can be installed either via npm or via the shadcn registry:
shadcn registry (recommended) copies the component source directly into your project (under components/), so you own and can customize the code. This is the preferred method since it gives you full control over styling and behavior.
npm installs the package as a regular dependency from the npm registry. Use this if you'd rather not vendor the component source into your repo.
Setup
Since the shadcn registry is the recommended install method, add the editorcn registry to your components.json first (skip this if you're installing via npm only):
If you installed via the shadcn registry, the package is copied into your project, so import from your local components path instead of @editorcn/editor:
Copy import { RichTextEditor, Link } from '@/components/editor'; import "@/components/editor/style.css";
If you installed via the shadcn registry, the package is copied into your project, so import from your local components path instead of @editorcn/block-editor:
Copyimport {BlockEditor,SlashCommand,defaultSlashCommandItems,getSlashCommandSuggestion,} from '@/components/block-editor';import "@/components/block-editor/style.css";
Copy"use client";import { useEditor } from "@tiptap/react";import StarterKit from "@tiptap/starter-kit";import Underline from "@tiptap/extension-underline";import Placeholder from "@tiptap/extension-placeholder";import { BlockEditor, SlashCommand, defaultSlashCommandItems, getSlashCommandSuggestion,} from "@editorcn/block-editor";import "@editorcn/block-editor/style.css";export function MyEditor() { const editor = useEditor({ immediatelyRender: false, shouldRerenderOnTransaction: false, extensions: [ StarterKit.configure({ heading: { levels: [1, 2, 3] } }), Placeholder.configure({ placeholder: "Type / for commands..." }), Underline, SlashCommand.configure({ suggestion: getSlashCommandSuggestion(), }), ], }); return <BlockEditor editor={editor} />;}
All @tiptap/* packages are peer dependencies — you must install them in your project. This ensures a single copy of Tiptap's types and avoids "duplicate instance" TypeScript errors.
This applies regardless of install method: npm installs list them explicitly as shown above, and the shadcn registry installer will prompt you to add any peer dependencies it detects are missing.