Skip to content

InputRichText ​

Several lines of text with bold, italic and underline, e.g. notes on a student or an application.

Open in Storybook to try every prop.

When to use ​

  • Notes and comments where people want to stress a word or two.

When not to use ​

  • A single line: use Input.
  • Plain text that's processed or exported (an address, a reason code): a plain text field, as formatting would be lost or get in the way.
  • Documents with headings, lists or links: not supported on purpose, so notes look the same everywhere.

Anatomy ​

PartRequiredNotes
label, helper, message—As every field (FormField).
boxYesFormField's box, holding the toolbar and the text area edge to edge.
toolbarYesBold, Italic, Underline: small square ghost Buttons, 6px padding, black 15% line under it.
text areaYes12px / 8px padding, 14px text. At least 4 lines (96px); grows to 15 lines (320px), then scrolls.
placeholderNoBlack 55%, in the empty text area.

Properties ​

PropertyTypeDefaultDescription
modelValuestring (HTML)''Only <p>, <br>, <strong>, <em>, <u>. Empty is ''.
labelstring—Required.
helper / helperPlacementstring / below | icon— / belowAs every field.
errorText / status / statusText—As every field; loading suits saving as you type.
placeholderstring—e.g. "Add a note…".
disabledbooleanfalse40% opacity, not editable.

States ​

StateAppearanceNotes
Format onBlack 15% fill behind the button.Follows the text at the cursor.
FocusedFocus ring around the whole box.
Error / successBox border and message coloured.
Disabled40% opacity.

Behaviour ​

  • ⌘B / ⌘I / ⌘U (Ctrl on Windows and Linux) toggle formatting; ⌘Z undoes.
  • Pressing a toolbar button keeps focus and the selection in the text.
  • Enter starts a new paragraph (8px apart); Shift+Enter a line break.
  • Pasted text keeps bold, italic and underline only.

Accessibility ​

  • The text area is role="textbox" with aria-multiline, named by the label; helper and message are its description.
  • The toolbar is role="toolbar" named "Formatting for {label}". Buttons use aria-pressed and aria-keyshortcuts, with a Tooltip showing the shortcut.
  • Pressing the label focuses the text area.

Security ​

The value is HTML from the browser. Sanitise it on the server (allow only p, br, strong, em, u) before storing or showing it anywhere else.

Platform adaptation ​

PlatformImplementationDifferences
Web / desktop (Vue)InputRichText.vueTiptap (ProseMirror) with only these marks.
iOS (SwiftUI)—TextEditor with AttributedString (iOS 26), or a UITextView wrapper; formatting from the edit menu and ⌘B / ⌘I / ⌘U.
Android (Compose)—BasicTextField with a rich-text state library; same three marks.

Tokens used ​

TokenUsed for
color-focusFocus ring
color-red / color-greenError / success

Released under the PolyForm Noncommercial License 1.0.0.