Skip to main content
Features add editing controls, node types, and conversion behavior. Import them from @frogbotai/richtext-lexical and pass them to lexicalEditor. Every feature is configurable. You can use the recommended defaults, remove features you do not need, or add your own feature providers.

Features overview

Each feature is a function that returns a feature provider, such as BoldFeature(). The features with options are documented below. Every other feature takes no arguments: BoldFeature, ItalicFeature, UnderlineFeature, StrikethroughFeature, SubscriptFeature, SuperscriptFeature, InlineCodeFeature, ParagraphFeature, AlignFeature, UnorderedListFeature, OrderedListFeature, ChecklistFeature, BlockquoteFeature, HorizontalRuleFeature, InlineToolbarFeature, TreeViewFeature, and TableFeature.

Configure headings

Bold, italic, underline, strikethrough, subscript, superscript, and inline code features add their corresponding formatting controls. Bold, italic, underline, and inline code also support their conventional keyboard shortcuts. Paragraph, heading, list, quote, and horizontal-rule features add slash-menu and toolbar entries, as applicable.

Configure indentation

Use disableTabNode to reserve Tab for block-level indentation. disabledNodes prevents selected node types from being indented.
Restrict internal links by collection, set their maximum population depth, and add fields to the link drawer:
Set either enabledCollections or disabledCollections, not both. disableAutoLinks: 'creationOnly' prevents automatic creation while retaining updates to existing auto-links; true disables both.

Configure relationships

Relationships can point to collections without uploads that keep admin.enableRichTextRelationship enabled (the default). enabledCollections and disabledCollections narrow that set further; set one or the other, not both.

Configure files

The upload feature supports your upload collections, including the one marked file: true. The example assumes your app declares a files collection. Fields configured for a collection are stored on that file node.
Set either enabledCollections or disabledCollections, not both. maxDepth limits population of the referenced file itself; it does not limit fields stored directly on the file node. File nodes can reference upload collections that keep admin.enableRichTextRelationship enabled (the default).

Configure toolbars

InlineToolbarFeature appears for selected text. FixedToolbarFeature stays visible and can follow whichever nested editor is focused.
InlineToolbarFeature takes no options.

Configure blocks

BlocksFeature accepts block-level and inline block definitions. Each definition keeps its fields and optional JSX import/export behavior.
See Converting JSX, Converting HTML, and Converting Markdown to render blocks. Every BlocksFeature option is listed in BlocksFeature options. TreeViewFeature adds an editor-state, DOM, and time-travel debugging panel. TableFeature adds table editing.

Configure text state

TextStateFeature stores configured values under the serialized text node’s $ property. Keep the state map in a shared module so the editor and frontend converter use the same styles.
Lexical serializes text state under the text node’s $ key. Frontend rendering must map those stored state values back to the same CSS configuration. Keep the state object in an import-safe shared module and use it from both TextStateFeature and your custom JSX text converter.