TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/alineacms/alinea/llms.txt
Use this file to discover all available pages before exploring further.
Field.richText field renders a full-featured block editor powered by Tiptap. Unlike classic WYSIWYG editors, Alinea’s rich text field does not produce HTML strings. It stores content as a structured document — an array of typed nodes that can be traversed, transformed, and rendered with full type safety. This makes it straightforward to render rich text in any environment, from server-side React to a native mobile app.
Importing Field
Basic usage
Defining a rich text field
TextDoc value, which is an array of Node objects. Alinea ships with a createRichTextView rendering helper for React, but the structure is fully inspectable without it.
The TextDoc type
TheTextDoc<T> type is the data structure stored for every rich text field. It is an array of Node values. Three node kinds exist:
| Node kind | _type prefix | Description |
|---|---|---|
TextNode | "text" | A leaf text run with optional inline marks |
ElementNode | lowercase string | A structural element such as "paragraph" or "heading" |
BlockNode | uppercase string | A custom embedded block; keys match your schema definition |
TextDoc type shape
Embedding custom block types
Pass aschema option to allow editors to insert custom block types between paragraphs. Each key in schema becomes a selectable block type in the editor toolbar.
Rich text with embedded blocks
BlockNode discriminated union from the schema object.
Enabling tables
SetenableTables: true to add table support to the editor toolbar.
Rich text with table support
Options reference
A map of
Config.type(...) definitions. Each key is an uppercase block type that editors can insert into the document. Block data is fully typed and validated.When
true, all text content inside this field is indexed for full-text search in the dashboard and query layer.Prevents saving an entry if the field is empty.
Adds a table insertion and editing toolbar to the editor. Defaults to
false.Fine-grained control over which toolbar sections and items appear in the editor. Import prebuilt sections from
alinea/field/richtext/Toolbar.Override or extend the underlying Tiptap extensions. Import the defaults from
alinea/field/richtext/Extensions and spread them alongside your overrides.Instructional text displayed below the field label.
The document value pre-populated when a new entry is created.
Renders the editor in a non-editable state.
Compact rendering without the full toolbar chrome.
Fractional form width (0–1).
Setting an initial value
TheinitialValue option accepts a TextDoc array. You can build it manually or use Edit.richText() to compose it programmatically.
Using Edit.richText() for initial values
Edit.richText() accepts an optional existing TextDoc to start from and exposes an .addHtml(html) method that parses HTML into TextDoc nodes, plus a .value() method that returns the completed document.
Rendering rich text
Use the@alinea/ui rendering utilities or write your own renderer that traverses the TextDoc array. Here is a minimal custom renderer in React:
Rendering a TextDoc in React
Rich text inside list rows
Field.richText can be nested inside Field.list or Field.object block types to create rich structured content:
Rich text nested in a list schema