Rich text editor
A small editor with bold, italic, lists and links, returning HTML.
When to use
- Notes and descriptions that need light formatting.
- You want an icon toolbar with correct pressed states.
When not to use
- Plain text is enough; use a textarea.
- You need a full document editor with blocks.
Installation
terminal
pnpm dlx shadcn@latest add @caliper/rich-text-editor
Adds its 3 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
API reference
RichTextEditor
4 props
PropTypeDefaultDescription
label *string—
defaultValuestring""Starting HTML, such as a saved `onChange` value. Trusted or sanitised HTML only.
onChange((html: string) => void)—
classNamestring—
Keyboard
- Enter
- Activates the focused control.
- Escape
- Closes or cancels, then returns focus to where it came from.
Accessibility
It exposes toolbar and textbox semantics, with aria-label, aria-pressed, aria-hidden and aria-multiline kept in step with state.
Notes for AI
Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.
/docs/components/rich-text-editor.mdThe index of every part is at /llms.txt.