FormEngineRenderer
The drop-in React component for rendering forms.
FormEngineRenderer is the primary React component for rendering a form from a schema. It creates the engine internally, applies theming, renders all fields, and handles navigation and submission.
Basic Usage
Props
| Prop | Type | Description |
|---|---|---|
schema | FormEngineSchema | The form schema (required) |
onSubmit | (response: FormResponse) => void | Callback when form is submitted |
adapters | SubmitAdapter | SubmitAdapter[] | Storage adapters for persistence |
theme | FormEngineTheme | Theme preset or custom theme |
components | FieldRegistry | Custom field component overrides |
prefill | Record<string, unknown> | Pre-fill values from external data |
initialValues | Record<string, unknown> | Initial field values |
className | string | CSS class for the wrapper |
sessionToken | string | Token for draft persistence |
validators | Record<string, CustomValidator> | Custom sync validators |
asyncValidators | Record<string, AsyncValidator> | Custom async validators |
Callback Props
| Prop | Type | Description |
|---|---|---|
onReady | (engine: FormEngine) => void | Called when the engine is initialized |
onFieldChange | (fieldId: string, value: unknown) => void | Called on every field change |
onSectionChange | (sectionId: string, index: number) => void | Called when navigating between sections |
onValidationError | (errors: Record<string, string[]>) => void | Called when validation fails |
onStateChange | (state: FormState) => void | Called on any state change |
Label Props
| Prop | Type | Default |
|---|---|---|
prevLabel | string | "Back" |
nextLabel | string | "Next" |
submitLabel | string | "Submit" |
With Theme
With Custom Components
With Adapters
With Draft Persistence
When sessionToken is provided and the schema has allowDraftSave: true, the renderer automatically saves drafts and shows a resume prompt if a previous draft is found.
Accessing the Engine
Use the onReady callback to get a reference to the engine for imperative operations:
What It Renders
Internally, FormEngineRenderer composes these sub-components:
FormEngineThemeProvider— applies CSS variables for themingProgressBar— section progress indicatorSectionRenderer— renders the current section and its fieldsNavigationButtons— Back / Next / Submit buttonsErrorSummary— validation errors after submit attemptDraftResumePrompt— resume prompt when a draft is detectedCompletionScreen— shown after successful submission