Skip to main content

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!

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 to error to display validation feedback below the editor.

Read-only

Pass disabled to prevent editing. The toolbar remains visible but all controls are disabled.

With Mentions

Enable allowMention 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

Enable allowMedia 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 defaultValue to set initial HTML content. The editor manages its own internal state.
  • Controlled — Pass value and onChange to manage content externally. onChange fires on every change with the serialized HTML string.
Use 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 corresponding allow* prop. Text formatting and alignment are enabled by default; all other sections are disabled unless explicitly enabled.
FeaturePropDefault
Text type, font size, bold, italic, underline, strikethroughallowTextFormattrue
Left, center, right, justify alignmentallowTextAlignmenttrue
Ordered and unordered lists, indent controlsallowListsfalse
Checklist (task list)allowChecklistfalse
Inline codeallowCodefalse
BlockquoteallowBlockquotefalse
Link insert and removeallowLinkfalse
@mention typeaheadallowMentionfalse
Drag handle for block reorderingallowDragDropfalse
Image upload and YouTube embeddingallowMediafalse

Mentions

Enable @mention support with allowMention. 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 with allowMedia. 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.
<RichTextEditor
  allowMedia
  onImageUpload={(files, onComplete) => {
    uploadFiles(files).then((urls) => onComplete(urls));
  }}
/>
Control accepted file types with allowedMimeTypes. When omitted, the editor defaults to common image formats.
Last modified on April 28, 2026