Rich Text Editor
Headings, bold, italic, lists, quotes, code and links, with the toolbar as a single tab stop and arrow keys inside it. Links are edited in an inline field instead of a browser prompt. Outputs HTML.
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.
Installation
How you get it
One command. The CLI writes the file into components/ui/ and installs what it needs.
npx shadcn@latest add https://layropro.com/r/rich-text-editorAPI
“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.
| Prop | Type | Notes |
|---|---|---|
defaultValue | string | — |
onChange | (html: string, editor: Editor) => void | HTML on every change. |
placeholder | string | — |
maxLength | number | — |
minHeight | number | Minimum height of the writing area in px. Default 140. |
tools | Array<"heading" | "bold" | "italic" | "strike" | "code" | "bullet" | "ordered" | "quote" | "link" | "history"> | Which tools to show. Default: all. |
editable | boolean | — |
label | string | Accessible name for the writing area. |
className | string | — |
Dependencies
npm packages
@tiptap/extension-character-count@tiptap/extension-link@tiptap/extension-placeholder@tiptap/react@tiptap/starter-kitclsxlucide-reacttailwind-mergeLayro foundations, installed alongside it
layro-themetooltipLifetime access
Every component, and everything we ship next.
- All 65 components, source included
- The template, and everything released after you buy
- shadcn CLI or download — React 18/19, Tailwind v4
- One payment. No subscription.
More in Forms
Button
FreeSix variants, three sizes, a loading state that keeps its width, and an icon button that insists on a label.
Field
FreeLabel, hint, error and required marker, wired to whatever control is inside it.
Input
FreeText input with prefix and suffix, plus Password with a reveal toggle and Search that clears on Escape.