Rich Text Editor
Tiptap editor with a keyboard-friendly toolbar, inline link field and character count.
- Category
- Forms
- Access
- Free with an account
- Source
- 224 lines · one file
- Added
- 4 Oct 2026
The decision inside it
No window.prompt for links
A prompt blocks the page, cannot be styled and loses the selection on some browsers. The link field opens in the toolbar and keeps the selection it applies to.
When to use it
Use Rich Text Editor for longer writing with formatting: comments, descriptions, notes, emails. It is built on Tiptap and gives you HTML on every change. Limit the toolbar with tools, and set maxLength to show a counter as the limit gets close. For plain text, Textarea is lighter.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Liro's Rich Text Editor for this.
Install it: npx shadcn@latest add @liro/rich-text-editor
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/rich-text-editor.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Free components install through the @liro registry with your CLI token: see the Namespaced tab.
Usage
"use client";
import { RichTextEditor } from "@/components/ui/rich-text-editor";
export function DescriptionField({ onChange }: { onChange: (html: string) => void }) {
return (
<RichTextEditor
label="Description"
placeholder="Describe the change…"
tools={["bold", "italic", "bullet", "ordered", "link"]}
maxLength={2000}
onChange={(html) => onChange(html)}
/>
);
}API reference
“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Type | Notes | ||
|---|---|---|---|
defaultValue | string | No | – |
onChange | (html: string, editor: Editor) => void | No | HTML on every change. |
placeholder | string | No | – |
maxLength | number | No | – |
minHeight | number | No | Minimum height of the writing area in px. Default 140. |
tools | Array<"heading" | "bold" | "italic" | "strike" | "code" | "bullet" | "ordered" | "quote" | "link" | "history"> | No | Which tools to show. Default: all. |
editable | boolean | No | – |
label | string | No | Accessible name for the writing area. |
className | string | No | – |
Dependencies
npm packages
@tiptap/extensions@tiptap/react@tiptap/starter-kitclsxlucide-reacttailwind-mergeLiro foundations, installed alongside it
liro-themetooltipAccessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances