DocEngine

Docs

Field types

Every token in the document is a typed field. Design mode inserts and configures schemas; fill mode edits values; preview and PDF render the same model. Open a type for a dedicated page.

Field ID structure

Each field has a stable internal id used in fieldSchemas, block fieldValues, and (optionally) computed formulas. IDs are derived from section name + field name:

deriveFieldId(sectionName, fieldName)
→ "{sectionSlug}_{fieldSlug}"

// Examples
Section "Anamnesis" + field "Complaints"  → anamnesis_complaints
Section "Header" + field "Customer Name" → header_customer_name
Duplicate name in same section           → header_customer_name_2
  • Slugs come from labelToFieldKey (letters, digits, underscore; valid id: /^[a-zA-Z_][a-zA-Z0-9_]*$/).
  • Table cells:cellFieldId(tableId, rowKey, colKey) → {tableId}_{rowKey}_{colKey} (e.g. items_table_row5_column_1).
  • Document export v2 and Mapping use human section / field names, not raw ids. Prefer those in computed formulas.
  • Moving a field across sections re-derives its id and rewrites computed formula paths that reference it.

Common properties

In Design mode, select a field token to edit its schema. These options are shared by every field type. Type-specific controls are documented on each type page. Computed fields omit Read-only when filling — they are always read-only in fill mode.

Label
Text shown on the field token / picker title in the document. Can differ from Field Name.
Field Name
Used in document export and to generate the field ID.
Field type
Schema type for this token. Changing type converts the schema and swaps type-specific options.
Required value
When on, finish / validation fails if the field is empty in fill mode.
Read-only when filling
Users can see the value but cannot change it in fill mode.
Value display style
Select this field in the document and use the Format panel to style its value. For table cells, click any cell to select the whole column. Use Tx to reset to the editor default.

Quick reference

Texttext

Value: string

Use when: Free-form labels, notes, addresses, titles.

Default inline token for prose. Supports required validation. Properties & details →

Numberinteger

Value: string (digits) or empty

Use when: Quantities, scores, money amounts.

Numeric input stored as digit strings; display can format as number or currency. Properties & details →

Datedate

Value: ISO YYYY-MM-DD or empty

Use when: Visit dates, due dates, document dates.

Calendar field provided by the @docengine/field-date plugin (not a core built-in). Properties & details →

Choicechoice

Value: string (selected label) or empty

Use when: Single option from a fixed set (Yes/No, status).

Single-select from inline items or a shared catalog list. Properties & details →

Listlist

Value: string[] (selected labels)

Use when: Multi-select tags, diagnoses, product codes.

Multi-select from static items, catalogs, or remote search. Properties & details →

Treetree

Value: string[] (selected leaf paths)

Use when: Hierarchical catalogs (complaints, ICD-style trees).

Multi-select from a nested tree of nodes. Properties & details →

Tabletable

Value: Row/cell map (per-cell field values)

Use when: Line items, grids, OD/OS-style fixed rows.

Grid of cells; each cell is its own field id under the table. Properties & details →

Pivot tablepivotTable

Value: { columns, rows, columnTotals?, grandTotal? }

Use when: Cross-tabs from line items (region × product totals, matrix reports).

Auto-pivot / cross-tab field: at mapping time DocEngine reads a source array, groups by row/column properties, aggregates values, and stores a structured matrix — read-only in fill mode. Properties & details →

Imageimage

Value: { url, caption? }

Use when: Photos, logos, and other images in the document body.

Image token with URL (and optional caption); host should persist durable URLs. Properties & details →

Logicallogical

Value: true | false | empty (null)

Use when: Yes/No acknowledgments, flags, consent checkboxes, boolean CRM fields.

Boolean Yes/No field. Stored as true, false, or empty (null). Fill mode uses inline click-to-cycle — no modal. Properties & details →

Signaturesignature

Value: PNG data URL string (or empty)

Use when: Internal acknowledgment / validation signatures drawn on the document face.

Native digital signature capture via an HTML5 canvas pad (mouse/touch). On save, the value is a PNG data URL string rendered like an image token. Properties & details →

Barcodebarcode

Value: string (payload to encode)

Use when: Scannable Code 128, QR, EAN-13, or Code 39 printed on the document face.

Drag-and-drop native barcode field. The stored value is the string to encode; the token renders a generated barcode/QR image (bwip-js) as field-token--image + field-token--barcode. Properties & details →

Computedcomputed

Value: string (evaluated, read-only in fill)

Use when: Totals, concatenations, derived labels.

Formula-driven read-only field; extend with registerFormulaFunction. Properties & details →

Child / repeaterchild

Value: Nested instances / child document chunks

Use when: Repeating groups (multiple contacts, exams, line blocks).

Design a child layout once; fill mode adds multiple instances. Properties & details →

Custom field types

Built-ins cover most documents. Hosts can add or replace types with a FieldHandler via registerField before createEditor. The reference plugin is Date (@docengine/field-date) — Date is not bundled in the core editor.

Custom types guide

Design tips

  • Stable section names and field names become export keys (sections / Mapping targets).
  • Use columns for side-by-side layout; nest fields and tables inside columns.
  • Mark required fields early — validation runs before finish / PDF in host apps.
  • For searchable external data, configure a List as remote — see Lists & queries.
  • Formula-driven values: Computed · formula functions.

Export shapes

Full document: kind: "document" (blocks + schemas + values). Template only: kind: "template" (values reset to defaults). Values only: kind: "field" with nested sections (v2) — what n8n often receives as fill input.

Related: Mapping · Storage & versions · API & hosts