Rich Text Editor
A composable rich text editor built on Tiptap, with a toolbar, bubble menu, character count and typeset content.
Typography is rendered inside a shadcn/typeset container. Nodes and marks are separate items: install the ones you compose into the rich text editor.
Preview
Installation
Add the item with the shadcn CLI, or copy the source manually.
pnpm dlx shadcn@latest add litingyes/blocove/rich-text-editorRequires a shadcn/ui project set up with Base UI primitives. Blocove is developed against the b0 preset, but it installs no base config or theme tokens: your own preset, fonts and colors stay in place.
Or install from the namespace after adding the registry: npx shadcn@latest add @blocove/rich-text-editor
This example also uses: rich-text-editor-headingrich-text-editor-code-blockrich-text-editor-boldrich-text-editor-italicrich-text-editor-underlinerich-text-editor-strikerich-text-editor-coderich-text-editor-link
pnpm dlx shadcn@latest add litingyes/blocove/rich-text-editor-heading litingyes/blocove/rich-text-editor-code-block litingyes/blocove/rich-text-editor-bold litingyes/blocove/rich-text-editor-italic litingyes/blocove/rich-text-editor-underline litingyes/blocove/rich-text-editor-strike litingyes/blocove/rich-text-editor-code litingyes/blocove/rich-text-editor-linktypeset.css next to your stylesheet, import it after Tailwind and add the .typeset-docs preset. See the Rich text editor setup.Usage
curl -o src/typeset.css https://ui.shadcn.com/typeset.css/* src/styles.css */@import "tailwindcss";@import "./typeset.css";@import "@fontsource-variable/inter";@import "@fontsource-variable/jetbrains-mono";
.typeset-docs { --typeset-font-body: var(--font-inter); --typeset-font-heading: var(--font-inter); --typeset-font-mono: var(--font-jetbrains-mono); --typeset-size: 16px; --typeset-leading: 1.75; --typeset-flow: 1.25em;}API Reference
Props accepted by the exported components.
Editor
Root component. Registers the declared extensions and provides the editor context.
| Prop | Type | Default |
|---|---|---|
value | string | - |
defaultValue | string | - |
onChange | (html: string) => void | - |
placeholder | string | "Start writing…" |
editable | boolean | true |
autoFocus | boolean | false |
characterLimit | number | - |
extensions | Extensions | - |
onReady | (editor: Editor) => void | - |
className | string | - |
editorProps | EditorProps | - |
children | ReactNode | - |
EditorContent
Editable surface. Wraps the ProseMirror document in the typeset container.
| Prop | Type | Default |
|---|---|---|
className | string | - |
typeset | boolean | true |
...props | React.ComponentProps<'div'> | - |
EditorToolbar
Toolbar with undo/redo, alignment and clear formatting. Children are extension controls.
| Prop | Type | Default |
|---|---|---|
className | string | - |
children | ReactNode | - |
EditorCharacterCount
Live character and word count for the current document.
| Prop | Type | Default |
|---|---|---|
className | string | - |
format | "characters" | "words" | "both" | "characters" |
defineExtensionComponent
Declares a Tiptap extension as a component that the Editor collects from its children.
| Prop | Type | Default |
|---|---|---|
name | string | - |
extension | (props) => Extensions | - |
returns | ExtensionComponent | - |