Rich text editor
A rich text editor takes formatted writing: headings, emphasis, lists, quotes and links. It runs on Tiptap, with a toolbar for people who reach for the pointer and Markdown shortcuts for people who don't.
Features
- Bold, italic, strikethrough, inline code, a heading, lists, quotes and links
from the toolbar, a shortcut, or Markdown as you type (
##,-,1.,>, backticks). - One tab stop for the whole toolbar; arrows, Home and End move inside it, and each button says whether it's on.
- Links go in through a row under the toolbar, never a browser prompt.
maxLengthstops typing and pasting at the limit and counts down from 80%.- In a narrow frame the toolbar stays one row and scrolls sideways, so the writing area doesn't drop below a second row of tools.
Examples
Screen readers hear the count when it first shows, at each further ten characters, and at the limit, not on every keystroke.
Read only
editable={false} drops the toolbar and shows the document as it will read.
Proposal reply
A reply box with a short toolbar and a limit. The visible label names the
writing area through aria-labelledby and the hint describes it through
aria-describedby. Sending clears it by remounting it with a new key.
Up to 500 characters. The team sees it in the proposal thread.
Anatomy
A frame around a toolbar, the writing area and an optional count. The link row opens between the toolbar and the writing area while a link is being added, and a hidden live region reads the count at thresholds.
- Frame
- Toolbar
- Tool
- Content
- Count
Guidelines
- 01Use it where formatting changes what the words mean: notes, proposals, release notes, replies. For a plain message or a short answer, use a textarea or Chat composer.
- 02Show only the tools the content needs. A comment box rarely needs headings or code.
- 03State a length limit before people reach it, in the label or a description, not only in the counter.
- 04Store and send the HTML, and sanitise it wherever it's shown to someone else.
Best practices
Accessibility
- 01The writing area is a multi-line
textbox, named byaria-labelledbywhen it's given and bylabelotherwise. Pointaria-labelledbyat a visible label. - 02The toolbar is one tab stop. Arrow keys, Home and End move between its buttons, following the ARIA toolbar pattern. Marks and blocks carry
aria-pressed. - 03Clicking a tool keeps focus and the selection in the writing area. Running one from the keyboard sends focus back there.
- 04Undo and Redo stay focusable when there's nothing to do, so the toolbar's keyboard path never changes length.
- 05Escape closes the link row and returns to the writing area. The visible count is hidden from screen readers; a separate
aria-live="polite"region reads it when it first shows, at each further ten characters, and at the limit.
Related components
- TextareaIn fibo's Storybook
- Chat composerA message box built from parts around one draft, so each chat surface composes its own.
- FieldIn fibo's Storybook
- TooltipIn fibo's Storybook