Formatted text with a toolbar, keyboard shortcuts and markdown as you type; its value is HTML for forms.
$ pnpm dlx shadcn@latest add @dashral/rich-text-editorInstallation
$ pnpm dlx shadcn@latest add @dashral/rich-text-editorAdds the component, the components it builds on, its npm packages and the theme tokens it uses. Or by its full URL: https://dashral.com/r/rich-text-editor.json
When to use
- Formatted text people write: a description, release notes, a reply with lists and links.
- In a form: its value is HTML, sent under name, with a label, hint and error like any field.
When not to use
- Plain text, even long: Textarea (lighter, no HTML to store).
- A chat message to an assistant: Prompt Composer.
- Showing HTML you already have: Prose.
Usage
The HTML kept in state as it's typed, and sent with the form under name.
"use client"
import { useState } from "react"
import { Button } from "@/components/dashral/button"
import { RichTextEditor } from "@/components/dashral/rich-text-editor"
export default function JobDescription() {
const [html, setHtml] = useState("")
return (
<form action="/jobs" method="post" className="grid max-w-xl gap-4">
<RichTextEditor
label="Job description"
name="description"
placeholder="The role, the team, what a good first month looks like…"
maxLength={2000}
value={html}
onValueChange={setHtml}
/>
<Button type="submit" className="w-fit" disabled={!html}>
Post job
</Button>
</form>
)
}Using the npm package? Import from @dashral/ui/components/rich-text-editor instead, here and in the examples; the rest is the same.
Examples
Write and preview
value and onValueChange keep the HTML in your state; Prose shows it as readers will.
Preview
Welcome aboard
Your workspace is ready. Start with the guide, then invite your team.
Tip: type ## for a heading or - for a list.
API reference
RichTextEditor
Built on Tiptap (open-source extensions only). Other props go on the box around the toolbar and the text.
| Prop | Type | Default |
|---|---|---|
label | ReactNodeShown above, linked to the control. | — |
description | ReactNodeA hint under the control. | — |
error | boolean | ReactNodetrue shows the error style; a message also shows under the control. | — |
labelAction | ReactNodeAt the end of the label's row, e.g. a “Forgot password?” link or the current value. | — |
withAsterisk | booleanMarks the label with an asterisk, e.g. alongside required. | false |
value | stringThe content as HTML, with onValueChange: it controls the editor. "" is empty. | — |
defaultValue | string | JSONContentThe starting content, as HTML or Tiptap JSON, when value isn't used. | — |
onValueChange | (html: string, editor: Editor) => voidCalled as the content changes, with the HTML ("" when empty). editor.getJSON() and editor.getText() give the other forms. | — |
name | stringSends the HTML with a form, in a hidden input of this name. | — |
placeholder | stringShown while it's empty. | — |
maxLength | numberStops typing and pasting past this many characters; the count shows in the last tenth. | — |
showCount | booleanAlways shows the character count ("120/500" with maxLength). | false |
toolbar | RichTextTool[] | falseThe tools, in order, "|" for a divider; undo and redo at the end sit at the far side. false hides it (shortcuts and markdown still work). | every tool |
headings | (1 | 2 | 3 | 4)[]The heading levels in the text style menu. | [1, 2, 3] |
actions | ReactNodeControls of your own at the end of the toolbar, e.g. an icon Button. | — |
readOnly | booleanShows the content without letting it change; the toolbar hides. | false |
disabled / required | booleanAs on other controls; required marks it aria-required (check the value on submit). | — |
autoFocus | booleanPuts the cursor at the end once it's ready. | false |
extensions | AnyExtension[]More Tiptap extensions, after the built-in ones. Changing the list remakes the editor. | — |
editorRef | Ref<Editor | null>The Tiptap editor once it exists, for commands of your own: editor.chain().focus().insertContent("@").run(). | — |
classNames | { root, label, description, error, editor, toolbar, content }Classes for each part. | — |
className | stringExtra classes, merged with cn() so yours win. | — |
RichTextTool
= "heading" | "bold" | "italic" | "underline" | "strike" | "code" | "bulletList" | "orderedList" | "blockquote" | "link" | "undo" | "redo" | "|"Keyboard
| Keys | Action |
|---|---|
| ⌘ Bor⌘ Ior⌘ U | Bold, italic, underline (Ctrl elsewhere) |
| ⌘ ⇧ Sor⌘ E | Strikethrough, inline code |
| ⌘ ⌥ 0–4 | Text, or a heading of that level |
| ⌘ ⇧ 8or⌘ ⇧ 7or⌘ ⇧ B | Bulleted list, numbered list, quote |
| ⌘ K | Add or edit a link |
| ⌘ Zor⌘ ⇧ Z | Undo, redo |
| Tabor⇧ Tab | In a list: indent or outdent the item |
| Alt F10 | From the text to the toolbar |
| ←or→, HomeorEnd | Along the toolbar |
| Esc | Close the link panel or the text style menu |
Accessibility
- With label, description or error, the id, aria-describedby and aria-invalid are wired up for you.
- The text is a multi-line textbox named by its label (aria-labelledby), so a click on the label writes in it too; give aria-label when there's no label.
- The toolbar is a toolbar (one Tab stop, arrows move along it). Each tool has a name and says whether it's on (aria-pressed); the text style button says the current style.
- Markdown as you type: ## and a space for a heading, - or 1. for a list, > for a quote, **text** for bold.
- Links take http, https, mailto and tel only; example.com becomes https://example.com.
- Its words come from the kit's messages, so a LocaleProvider translates them.
Motion
- The menu, link panel and tooltips use the kit's quick fade and zoom; the count fades in near the limit.
Blocks and screens
Sections and whole screens ready to drop in: the ones built with Rich Text Editor or for the same job first, then more from Dashral Pro. Free ones come with their code; Pro ones come with Dashral Pro.
The plan with dialogs to change or cancel it, what this period costs so far and where it's heading against the budget and alerts, usage with what going past each limit costs, spend alerts by email or Slack, the card on file and invoices. On motion.

API keys for live and test, a new key's secret shown once as its characters settle, revoking behind a hold, and webhooks: each endpoint with its recent deliveries, events and signing secret, a test event that lands in the log, deliveries opened with their payload and retried in place. On motion.

The workspace's name, logo, cover and colour, previewed live in the sidebar, the sign-in page, emails and invoices.



