Documentation Index
Fetch the complete documentation index at: https://anvil.servicetitan.com/llms.txt
Use this file to discover all available pages before exploring further.
Beta FeatureThis feature is currently in beta, and needs to be imported from
@servicetitan/anvil2/beta.While we hope to minimize breaking changes, they may occur due to feedback we receive or other improvements. These will always be documented in the changelog and communicated in Slack.Please reach out in the #ask-designsystem channel with any questions or feedback!- Implementation
- RichTextEditor Props
Live Component Playground
Common Examples
Basic Usage
A minimal editor with the default toolbar — text formatting and alignment enabled, everything else off.Error and Validation
Pass an error message string toerror to display validation feedback below the editor.Read-only
Passdisabled to prevent editing. The toolbar remains visible but all controls are disabled.With Mentions
EnableallowMention and supply mentionOptions to support @mention typeahead. Use onMentionInputChange to filter options as the user types, and renderMentionHoverContent to show a custom hover card over inserted mentions.With Media
EnableallowMedia with a required onImageUpload handler to support image uploads and YouTube embeds.All Features
All toolbar sections enabled together: formatting, alignment, lists, checklist, code, blockquote, link, mentions, drag-and-drop, and media.Controlled vs Uncontrolled
RichTextEditor supports both controlled and uncontrolled modes.- Uncontrolled — Pass
defaultValueto set initial HTML content. The editor manages its own internal state. - Controlled — Pass
valueandonChangeto manage content externally.onChangefires on every change with the serialized HTML string.
onJsonChange when you need access to TipTap’s JSON representation for more granular content handling.Toolbar Features
Each toolbar section is opt-in via a correspondingallow* prop. Text formatting and alignment are enabled by default; all other sections are disabled unless explicitly enabled.| Feature | Prop | Default |
|---|---|---|
| Text type, font size, bold, italic, underline, strikethrough | allowTextFormat | true |
| Left, center, right, justify alignment | allowTextAlignment | true |
| Ordered and unordered lists, indent controls | allowLists | false |
| Checklist (task list) | allowChecklist | false |
| Inline code | allowCode | false |
| Blockquote | allowBlockquote | false |
| Link insert and remove | allowLink | false |
| @mention typeahead | allowMention | false |
| Drag handle for block reordering | allowDragDrop | false |
| Image upload and YouTube embedding | allowMedia | false |
Mentions
Enable @mention support withallowMention. Supply mentionOptions as an array of { id, label } objects and use onMentionInputChange to filter options dynamically as the user types.Customize the dropdown item appearance with renderMentionOption and the hover card shown over inserted mentions with renderMentionHoverContent.Media
Enable image and YouTube embedding withallowMedia. When allowMedia is true, onImageUpload is required. The callback receives the selected File[] and an onComplete callback — invoke it with the resolved image URLs once upload finishes.allowedMimeTypes. When omitted, the editor defaults to common image formats.