Skip to main content

Rich Content

Note

This component is the updated and improved version of the RichText component.
RichContent should be preferred over RichText for new developments.


RichContent is a powerful editor component built on TipTap v2. It provides a rich text editing experience with extensive formatting options, image uploads, tables, and more. The component uses modern extensions like StarterKit, TextAlign, Color, Link, Image, and Table support.

Props

AttributeDescriptionTypeDefault
ToolbarColorDefine toolbar background color of the RichContent.string""
buttonsHideControl visibility of the toolbar buttons. When true, toolbar is hidden.booleanfalse
disabledDisable RichContent component. Makes editor non-interactive.booleanfalse
readonlyMakes the RichContent content non-editable while still allowing selection.booleanfalse
heightSets the height of the Rich Content editor area.string"auto"
widthSets the width of the Rich Content component.string-
minHeightSets minimum height of the RichContent editor area.string"auto"
tabindexAllows component to give and receive focus.number
contentRichContent HTML content value; controls editor HTML content.stringDefault sample text

Events

EventDescriptionPayload
inputEvent emitted when content changes (on every keystroke/edit)string
focusEvent emitted when editor gains focusstring
blurEvent emitted when editor loses focusstring
changeEvent emitted when content changes AND editor loses focus (on blur if changed)string
initEvent emitted when editor is initialized and readystring

Methods

MethodParametersReturn TypeDescription
getHTML-stringReturns current editor content as HTML string.
setContenthtmlContent: string, emitUpdate?: booleanvoidReplaces the editor content with the passed HTML value. If emitUpdate is false, no input event is emitted.
insertContenthtmlContent: stringvoidInserts the passed HTML value into the document at the cursor location.

Toolbar Features

The component includes a comprehensive toolbar with the following formatting options:

Text Formatting

  • Bold, Italic, Underline, Strikethrough
  • Code inline formatting

Text Alignment

  • Left, Center, Right, Justify alignment options

Lists

  • Bullet lists
  • Numbered/Ordered lists

Block Elements

  • Heading 1, 2, 3
  • Paragraph
  • Blockquote
  • Horizontal Rule

Advanced Features

  • Image insertion: Supports both URL and file upload (drag & drop supported)
  • Table creation: Dynamic table insertion with configurable rows, columns, and header options
  • Undo/Redo functionality

Usage Examples

RichContent-Default

— Basic editor initialized with default placeholder content and a fully visible toolbar.

image

RichContent-Content

— Demonstrates how to set and control the editor's HTML content via the content prop. Changes to the prop are reflected in the editor in real time.

image

RichContent-InsertContent

— Shows how to use the insertContent method to inject HTML at the current cursor position without overwriting existing content.

image

RichContent-SetContent

— Shows how to use the setContent method to fully replace the editor content with new HTML programmatically.

image