Powerful and customizable React text editor components built for modern applications and websites. These text editors are built using TipTap and styled with Tailwind CSS.
Installation
You can add this Text editor component using our CLI or manually:
npx untitledui@latest add text-editor
Text editor examples
Below are examples and variations of this text editor component:
API reference
Import the parts and assemble them:
import { TextEditor } from "@/components/base/text-editor/text-editor"; import { TextEditorBold, TextEditorItalic } from "@/components/base/text-editor/text-editor-extensions"; <TextEditor.Root> <TextEditor.Label /> <TextEditor.Toolbar /> <TextEditor.Content /> <TextEditor.HintText /> </TextEditor.Root> <TextEditor.Root> <TextEditorBold /> <TextEditorItalic /> <TextEditor.Content /> </TextEditor.Root>
TextEditor.Content
Renders EditorContent.
Also accepts all standard React DOM event handlers, all standard HTML attributes, all aria-* attributes.
TextEditor.HintText
Renders HintText.
Also accepts all standard HTML attributes, all aria-* attributes, all standard React DOM event handlers.
TextEditor.Label
Renders Label.
Props from React Aria Components (4)
Also accepts all standard HTML attributes, all aria-* attributes, all standard React DOM event handlers.
TextEditor.Root
Renders a <div> element.
Props from @tiptap/core (31)
TextEditor.Toolbar
Import TextEditorToolbar from @/components/base/text-editor/text-editor-toolbar. Renders a <div> element.
TextEditor.Tooltip
Import TextEditorTooltip from @/components/base/text-editor/text-editor-tooltip. Renders BubbleMenu.
TextEditorAlignCenter
Renders EditorButton.
TextEditorAlignJustify
Renders EditorButton.
TextEditorAlignLeft
Renders EditorButton.
TextEditorAlignRight
Renders EditorButton.
TextEditorBold
Renders EditorButton.
TextEditorBulletList
Renders EditorButton.
TextEditorColor
Renders React Aria’s DialogTrigger — all of its props are supported.
TextEditorFontFamily
Renders Select.
TextEditorFontSize
Renders Select.
TextEditorImage
Renders a <input> element.
TextEditorItalic
Renders EditorButton.
TextEditorLink
Renders EditorButton.
TextEditorUnderline
Renders EditorButton.
FAQs
Please refer to our frequently asked questions page for more.
No, the text editor is a PRO component. Sign in with npx untitledui@latest login, or pass your key with --license, before running npx untitledui@latest add text-editor.
It's built on Tiptap, so it needs @tiptap/core, @tiptap/react, @tiptap/pm, @tiptap/starter-kit, @tiptap/extension-text-style, @tiptap/extension-image, @tiptap/extension-placeholder, @tiptap/extension-text-align and @floating-ui/dom. The manual installation steps above include the full install command.
TextEditor.Root accepts Tiptap editor options, so pass the initial HTML with content and read changes in onUpdate, for example onUpdate={({ editor }) => setContent(editor.getHTML())} as in the examples. Set isDisabled to true to make the editor read-only.
Set limit on TextEditor.Root and render TextEditor.HintText without children to show how many characters are left. The limit isn't enforced: users can keep typing, and the hint switches to the error style once they go over, so check the length before saving.
TextEditor.Toolbar defaults to type="simple", with bold, italic, underline, text color, alignment and bullet list buttons. type="advanced" adds font family and font size selects plus link, image and generate buttons. Set floating to give the toolbar a card style; the font selects are hidden when it floats, and hideFontSize hides only the size select.
Add TextEditor.Tooltip inside TextEditor.Root. It uses Tiptap's bubble menu to show bold, italic, underline, alignment and link buttons next to the selection. Set theme to "dark" (default) or "light".
Yes. The image button inserts the chosen file as a temporary local blob URL, so upload the file to your own storage and replace the URL before saving. The generate button has no handler, so connect it to your own logic.