Playground

Setup

Add the rich text editor to a page: import, a controlled value, a toolbar and mentions.

Installation

The editor ships in @monoline/react, so there is no separate package and no extra peer dependency.

npm install @monoline/react @monoline/css

Import

import {RichTextEditor, sanitizeHtml} from '@monoline/react';

Usage

Controlled with a value and onValueChange, the same pattern as every other input. The value is an HTML string.

notes.tsx
const [html, setHtml] = useState('<p>Hello</p>');

<RichTextEditor aria-label="Release notes" value={html} onValueChange={setHtml} />

Handling data

Run saved HTML through sanitizeHtml before you render it anywhere else, and check links with isSafeUrl.

<div dangerouslySetInnerHTML={{__html: sanitizeHtml(html)}} />

See every prop on the Rich text editor page, and Mentions for @-mentions.