Pro unlocks unlimited templates48:00:00Get Pro →

Rich Text Editor

TipTap rich text with a compact toolbar. Default writing direction is ltr; set dir and lang to match your content. On phones the toolbar docks above the keyboard; on desktop it stays sticky at the top.

Simple

Default variant="simple" — one toolbar row with history, heading, marks, lists, and insert.

Loading…

Installation

CLI
npx @sonojs/ui@latest add rich-text-editor
Also needs
npx @sonojs/ui@latest add button dialog dropdown-menu input label popover separator toggle-group tooltip
npm i @tiptap/extension-highlight@^3.34.0 @tiptap/extension-image@^3.34.0 @tiptap/extension-link@^3.34.0 @tiptap/extension-placeholder@^3.34.0 @tiptap/extension-subscript@^3.34.0 @tiptap/extension-superscript@^3.34.0 @tiptap/extension-table@^3.34.0 @tiptap/extension-task-item@^3.34.0 @tiptap/extension-task-list@^3.34.0 @tiptap/extension-text-align@^3.34.0 @tiptap/extension-text-style@^3.34.0 @tiptap/extension-typography@^3.34.0 @tiptap/extension-underline@^3.34.0 @tiptap/pm@^3.34.0 @tiptap/react@^3.34.0 @tiptap/starter-kit@^3.34.0 lucide-react

Composition

structure
RichTextEditor
├── RichTextEditorToolbar (sticky / mobile keyboard dock)
└── EditorContent (TipTap)

Usage

rich-text-editor.tsx
"use client"

import { RichTextEditor } from "@/components/rich-text-editor"

export function Example() {
  return <RichTextEditor placeholder="Write something…" />
}

Props

PropTypeDefaultDescription
variant"simple" · "advanced""simple"Simple one-row toolbar, or advanced with a full second row always visible.
toolbarCollapsiblebooleanfalseOn advanced only: collapse row 2 behind an expand control.
dir"rtl" · "ltr" · "auto""ltr"Writing direction on the editor root. Also drives ProseMirror text align.
langstring"en"Language attribute on the editor root.
value / defaultValuestring · JSONContent-Controlled or uncontrolled HTML/JSON content.
onChange(payload: { html; json }) => void-Fires on every TipTap update with HTML and JSON.
placeholderstring"Write something…"Empty-state placeholder text.
disabled / readOnlybooleanfalseDisable interaction or lock content for reading.
onUploadImage(file: File) => Promise<string>-Optional uploader for the image dialog. Must return an http(s) URL.
hideToolbarbooleanfalseHide the chrome toolbar (surface only).
minHeightnumber · string"16rem"Minimum height of the ProseMirror surface.