Component props
Required props
None - the component works with zero configuration.Optional props
object
Document loading configuration
object
Field configuration
Field insertion menu configuration
object
Field list sidebar configuration
boolean | string | ToolbarConfig
Document editing toolbar.
true: render a default toolbar containerstring: CSS selector of an existing element to mount the toolbar intoobject: full toolbar configuration (see ToolbarConfig)
'unlocked' | 'sdtLocked' | 'contentLocked' | 'sdtContentLocked'
Lock mode for all inserted fields. Per-field
lockMode overrides this. See lock modes.Record<string, string>
Colors for field types in the document and sidebar. Keys are
fieldType values, values are CSS colors (e.g. { owner: '#629be7', signer: '#d97706' }). Generates scoped CSS automatically: no stylesheet import needed.string
Content Security Policy nonce for dynamically injected styles
string
CSS class name for the root container
React.CSSProperties
Inline styles for the root container
string
default:"'600px'"
Height of the document editor area
object
Telemetry configuration. Enabled by default with
source: 'template-builder' metadata. See Telemetry for details.string
License key for SuperDoc. Passed directly to the underlying SuperDoc instance.
() => void
Called when the document is loaded and ready
(event: TriggerEvent) => void
Called when the trigger pattern is typed
(field: TemplateField) => void
Called when a field is inserted
(field: TemplateField) => void
Called when a field is modified
(fieldId: string | number) => void
Called when a field is removed
(fields: TemplateField[]) => void
Called whenever the complete field list changes
(field: TemplateField | null) => void
Called when a field is selected/deselected in the document
(field: FieldDefinition) => void | Promise<FieldDefinition | void>
Called when user creates a new field (requires
fields.allowCreate = true). Return a modified FieldDefinition to override the field before insertion, or void to use the field as-is.(event: ExportEvent) => void
Called when template is exported via
exportTemplate(). Use this to persist field metadata to your database alongside the document.Types
FieldDefinition
Available fields that users can insert:presetContent is applied only for mode: "block" fields. Inline fields ignore it.
TemplateField
Fields that exist in the template document:TriggerEvent
Information about trigger detection:ExportEvent
Data provided when a template is exported:FieldMenuProps
Props passed to custom menu components:FieldListProps
Props passed to custom list components:ExportConfig
Configuration for template export:Ref methods
Access these methods via a ref:insertField()
Insert an inline field at the current cursor position:boolean - true if inserted successfully.
insertBlockField()
Insert a block-level field:boolean - true if inserted successfully.
updateField()
Update an existing field:boolean - true if updated successfully.
deleteField()
Remove a field from the template:boolean - true if deleted successfully. If the deleted field was the last in a group with two members, the remaining field’s group tag is automatically removed.
selectField()
Programmatically select a field:nextField()
Navigate to the next field (equivalent to Tab key):previousField()
Navigate to the previous field (equivalent to Shift+Tab):getFields()
Get all fields in the template:refresh()
Re-discover fields from the editor and triggeronFieldsChange. Use this when field data arrives asynchronously or after external changes to the document:
exportTemplate()
Export the template as a .docx file:Promise<void | Blob> depending on triggerDownload setting.
getSuperDoc()
Access the underlying SuperDoc editor instance:SuperDoc | null.
Field type styling
Use thefieldColors prop to color-code fields by type:

