Technical Documentation

Schema Reference

The FormSchema is a strict JSON configuration that drives the entire Form Engine. This document provides a detailed specification of all available properties.

1. Root Schema (FormSchema)

PropertyTypeDescription
idstringUnique identifier. Used for localStorage persistence.
titlestringThe display title of the campaign/form.
descriptionstringOptional description of the form.
__schemaVersionnumberCrucial: Changing this value wipes old drafts for all users.
stepsFormStep[]Array of steps for multi-step navigation.
resourceRegistryRecord<string, entry>Maps resource IDs to API endpoints for dynamic selects.
themeFormThemeOptional branding (logoUrl, primaryColor).
scheduleFormScheduleOptional availability window (openingDate, closingDate).

FormTheme

PropertyTypeDescription
logoUrlstringURL to the logo image shown in the header.
primaryColorstringPrimary branding color in hex format (e.g. #3b82f6).

FormSchedule

PropertyTypeDescription
openingDatestringISO 8601 string representing when the form opens.
closingDatestringISO 8601 string representing when the form closes.

2. Step Definition (FormStep)

| headerMarkdown | string | Markdown content rendered at the top of the step. (Schema Steps only) | | sections | FormSection[] | Logical groupings of fields. (Schema Steps only) | | type | "schema" \| "custom" | The step rendering mode. Defaults to "schema". |

SchemaStep vs CustomStep

The engine uses a discriminated union for steps.

SchemaStep (type: "schema") The standard, data-driven step. Requires sections and optionally headerMarkdown.

CustomStep (type: "custom") A host-provided React component step. Does not support sections or headerMarkdown. It relies on the StepComponentRegistry for rendering.

{ "id": "payment-verification", "title": "Payment", "type": "custom" }

3. Section Definition (FormSection)

PropertyTypeDescription
idstringSection ID.
titlestringHeader text for the section.
descriptionstringOptional sub-header text.
defaultOpenbooleanWhether the section is expanded by default.
fieldsFormFieldDefinition[]The fields belonging to this section.

4. Field Definition (FormFieldDefinition)

PropertyTypeDescription
namestringField path. Supports nesting: profile.education.gpa.
typeFieldTypeInput component type.
labelstringField label.
placeholderstringGhost text inside the input.
helperTextstringSmall text shown below the input.
contentstringRich text content for non-input fields (e.g. markdown type).
validationValidationRulesRules for the Zod schema generator.
rulesRule[]Conditional logic (visibility, requirements, computed values).
dataSourceDataSourceConfig for fields with options (select, radio).
allowOtherbooleanIf true, adds an "Other" option with a companion text field.
layoutLayoutConfigLayout wrapper configuration (e.g. collapsible-card).
disabledbooleanWhether the field is permanently disabled.
hiddenByDefaultbooleanInitial visibility state. Recommended when using visible rules.

Note: visibleIf is a deprecated shorthand. Use rules with visible effects instead.

Supported FieldType

text, email, number, radio, checkbox, checkbox-group, select, combobox, searchable-select, textarea, date, file, markdown.

5. Validation Rules (ValidationRules)

Core Rules

RuleTypeDescription
requiredbooleanMandatory check.
messagestringDefault error message override (used for required if messages.required is not set).
messagesRecord<string, string>Custom error messages per rule key. e.g. { minLength: "Too short" }.

String Rules (text, email, textarea)

RuleTypeDescription
minLengthnumberMinimum number of characters.
maxLengthnumberMaximum number of characters.
emailbooleanValidates email address format.
regexstringCustom regex pattern the value must match.
startsWithstringValue must start with this string.
endsWithstringValue must end with this string.
includesstringValue must contain this string.
ignoreCasebooleanIf true, startsWith/endsWith/includes are case-insensitive.

Number Rules (number)

RuleTypeDescription
minnumberMinimum numeric value.
maxnumberMaximum numeric value.
minLengthnumberMinimum number of digits (e.g. phone number).
maxLengthnumberMaximum number of digits.
multipleOfnumberValue must be a multiple of this number.
startsWithstringString-cast of value must start with this.
endsWithstringString-cast of value must end with this.
includesstringString-cast of value must contain this.

Array Rules (checkbox-group)

RuleTypeDescription
minItemsnumberMinimum number of selected options.
maxItemsnumberMaximum number of selected options.
requireAllCheckedbooleanAll available options must be selected.

Date Rules (date)

RuleTypeDescription
minDatestringMinimum date. Accepts ISO string (e.g. "2024-01-01") or keyword "today" / "tomorrow".
maxDatestringMaximum date. Accepts ISO string or keyword "today" / "tomorrow".

File Rules (file)

RuleTypeDescription
maxFileSizenumberMaximum allowed file size in megabytes (MB).
acceptstringComma-separated list of allowed MIME types/extensions (e.g. .pdf).

6. Data Source (DataSource)

Fields like select or radio need a data source.

PropertyTypeDescription
mode"static" | "api"Where to get data.
optionsOptionItem[]Hardcoded options (used in static mode).
resourcestringID from resourceRegistry (used in api mode).
dependsOnstringName of a parent field that triggers a refetch when changed.
dependsOnParamstringQuery parameter name for the dependsOn value.