Skip to main content

RoosterRichTextEditor

RoosterRichTextEditor is a rich-text editor built on Microsoft's RoosterJS. It's controlled — you hold the HTML value and update it from onChange. The toolbar is configurable, and it supports a compact layout, a placeholder, and fixed row height.

When to use

  • Capture formatted content (notes, descriptions, comments) as HTML.
  • Anywhere you'd otherwise embed a heavyweight editor but want SpartanFX theming.

Import

import { RoosterRichTextEditor } from '@spartanfx/react';

Basic usage

value and onChange are required.

function Notes() {
const [html, setHtml] = React.useState('<p>Start typing…</p>');
return (
<RoosterRichTextEditor
value={html}
onChange={setHtml}
placeholder="Add a note"
rows={6}
/>
);
}

Compact toolbar and limited controls

Use compact for a tighter layout, and allowedControls to restrict which toolbar buttons appear.

<RoosterRichTextEditor
value={html}
onChange={setHtml}
compact
allowedControls={{ bold: true, italic: true, bulletedList: true }}
/>

Key props

PropTypeNotes
value (required)stringEditor HTML (controlled).
onChange (required)(content) => voidFires with updated HTML.
allowedControlsIAllowedControlsWhich toolbar controls to show.
compactbooleanTighter toolbar/layout.
rowsnumberFixed editor height in rows.
placeholderstringEmpty-state text.
disabledbooleanRead-only mode.
onBlur() => voidFires when the editor loses focus.

See the full generated reference: RoosterRichTextEditor API ↗ and IRoosterRichTextEditorProps.

See also