Component libraryRich text editor
Rich text editor
ProAuthor controlled formatted content with constrained native editing and JSON serialization.
npx shadcn@latest add @tidal-pro/rich-text-editorInstallation
Pro source is gated. Configure the @tidal-pro registry using the agent guide. Create an access key from your account after purchasing.
Terminal
Import components/ui/tidal.css, components/ui/rich-text-editor.css, components/ui/toolbar.css, then add the component inside a tidal-scope wrapper. Its scoped design tokens keep it independent of your existing CSS.
Usage
Complete example source · Dependency and asset manifest
Loading the complete example…
API & behavior
Required label, controlled value:string containing canonical Lexical EditorState JSON, and onValueChange(nextJson,editor). TIDAL_EMPTY_RICH_TEXT_DOCUMENT provides a valid empty value. The component uses the Lexical 0.52 extension composer with rich-text, list and link extensions plus a local history plugin; no HTML import path is exposed. The visible editor supports bold, italic, level-two heading, unordered-list, allowlisted link, undo and redo commands through the accepted TidalToolbar keyboard model. linkHref accepts hash, root-relative, http, https and mailto destinations; an unavailable value disables new link creation and renders a localized notice, while an existing selected link can still be removed. The top-level onPaste callback receives the native ClipboardEvent first; unless prevented, the editor handles the Lexical paste command at critical priority and inserts only text/plain. value remains consumer-owned: synchronous acceptance stays in place and a declined proposal is reapplied from the controlled prop. Invalid configuration JSON makes editing unavailable, while a consumer validation error sets aria-invalid and remains editable so it can be corrected. name/form serialize the exact controlled JSON through a successful native hidden input; disabled omits it from FormData, while readOnly preserves submission. Optional disabled/readOnly, description/error/placeholder, dir, theme, portalContainer, labels, native root attributes/ref, contentEditableProps/ref, hiddenInputProps/ref, editorRef and per-command native button props/refs are supported. Owned roles, accessible names, availability, content, replacement markup, controlled values and toolbar form-submit channels are type-excluded and runtime-stripped. The editable remains mounted, selection belongs to Lexical, toolbar pointer commands retain the live selection without forced focus, and consumer-directed focus is not reclaimed. No raw HTML ingestion, dangerous HTML injection, source execution, deprecated execCommand, upload, request, storage or publishing behavior is included.
Style with the --t-* CSS variables. Set data-theme="dark" on your tidal-scope wrapper for a dark surface. Motion respects the system’s reduced-motion preference.