label | string · requiredLabel text for the editor. Always rendered for accessibility. |
|---|
isLabelHidden | boolean · default falseVisually hide the label (still accessible to screen readers). |
|---|
description | stringDescription text displayed between the label and editor. |
|---|
defaultValue | stringInitial serialized editor state (JSON string from editorState.toJSON()). Read once on mount; the editor is uncontrolled. |
|---|
onChange | (editorState: EditorState, editor: LexicalEditor) => voidFired when content changes. Serialize with editorState.toJSON() for persistence. |
|---|
placeholder | stringPlaceholder text shown when the editor is empty. Uses the same responsive body typography and text inset as the editable content. |
|---|
isReadOnly | boolean · default falseWhether the editor is read-only (non-editable). |
|---|
isDisabled | boolean · default falseWhether the editor is disabled (non-editable, dimmed). |
|---|
status | { type: "warning" | "error" | "success"; message?: string }Validation status. Shows a colored border and status icon; an optional message follows the statusVariant placement. Error also sets aria-invalid. |
|---|
statusVariant | 'attached' | 'detached' | 'tooltip' · default 'attached'How the status is presented: attached keeps the icon in the editor and overlaps the message below; detached floats the message below with its own icon; tooltip hides the message box and reveals it from the focusable in-editor status icon. |
|---|
size | 'sm' | 'md' | 'lg' · default 'md'The size of the editor, affecting internal padding. |
|---|
nodes | ReadonlyArray<Klass<LexicalNode>>Additional Lexical nodes to register beyond the default OSS set (Heading, Quote, List, Link, Code). Extension point for custom nodes (mentions, images) without forking. |
|---|
toolbar | ReactNodeToolbar content rendered edge-to-edge at the top of the field, before the padded editing surface. Pass RichTextEditorToolbar here for correct visual and keyboard order. |
|---|
plugins | ReactNodeAdditional Lexical plugins rendered inside the composer. Compose mentions, autolink, and other editor behavior on top of the base editor. |
|---|
hasMarkdownShortcuts | boolean · default trueEnable Markdown shortcut typing (e.g. "# " for a heading). Uses the transformers prop (defaults to the standard @lexical/markdown transformers). |
|---|
transformers | ReadonlyArray<Transformer> · default TRANSFORMERSMarkdown transformers: the single source of truth for markdown behaviour. Defaults to the standard @lexical/markdown TRANSFORMERS. In Lexical the same array drives all three markdown operations (shortcut typing, markdown->state import, state->markdown export); this prop wires shortcut typing today and is the intended input for the serialization APIs added in later phases. Pass a custom array to support additional node types (e.g. transformers layered in via the nodes extension point) consistently across all three. Shortcut typing is only applied when hasMarkdownShortcuts is true. |
|---|
hasAutoFocus | boolean · default falseAutomatically focus the editor on mount. |
|---|
tabEscapeHint | string · default 'Press Escape then Tab to move focus out of the editor.'Screen-reader hint describing how to move focus out of the editor, since Tab is bound to indentation (press Escape, then Tab). Visually hidden, wired via aria-describedby. Override to localize; pass "" to omit. |
|---|
maxLength | numberMaximum number of characters. When set, a character counter (current/max) is displayed below the editor. Like TextArea, does not enforce the limit natively; the counter shows error styling when the plain-text length exceeds the limit. |
|---|
width | number | stringWidth of the field. Numbers are pixels, strings used as-is (e.g. "100%"). |
|---|
minHeight | SizeValue · default '4.5rem'Minimum height of the editable content surface. Numbers are pixels; strings are used as CSS lengths. Content continues growing beyond this height. |
|---|
xstyle | StyleXStylesStyleX styles for layout customization. Must be a stylex.create() value, not an inline style object. |
|---|