Skip to content
Reference

Serialized Schema ​

When you pass a form to Inertia, it is turned into JSON by Form::toArray(). This is the FormSchema object your page receives. You rarely need to read it directly, but it helps when writing custom fields or standalone components.

The excerpts below come from the demo form in the repository (playground/DemoForm.php), exported with php playground/export-schema.php.

Form ​

json
{
    "action": "/demo",
    "method": "post",
    "fieldsets": [ ... ],
    "data": { ... },
    "hasFiles": true,
    "scrollToFirstError": true,
    "resetOnSuccess": false,
    "class": null,
    "accent": null,
    "wizard": null
}
KeyTypeDescription
actionstring | nullSubmit URL. null when no route/URL is set or the form is unauthorized.
method'get' | 'post' | 'put' | 'patch' | 'delete'Lowercase HTTP method.
fieldsetsFieldsetSchema[]Every authorized fieldset. Loose fields are wrapped in fieldsets with legend: null.
dataobjectInitial values, keyed by field name (nested for dot names).
hasFilesbooleantrue when the form contains a file upload.
scrollToFirstErrorbooleanScroll to the first invalid field after a failed submit.
resetOnSuccessbooleanReset data after a successful submit.
classstring | nullExtra classes for the <form> element.
accentstring | nullAccent color from Form::accent(), applied as --erag-form-accent. null uses the default. The <Form> accent prop overrides it.
wizardWizardSettings | nullnull for normal forms. For a wizard: { nextLabel, backLabel, validateUrl, token }, the button texts, the step validation URL and the encrypted form token.

An unauthorized form serializes to action: null, method: 'post', empty fieldsets and data, false for the three flags, and null for class, accent and wizard.

data example ​

json
{
    "name": "",
    "email": "",
    "role": null,
    "contact_method": "email",
    "skills": [],
    "topics": [],
    "notifications": true,
    "volume": 40,
    "starts_on": "",
    "brand_color": "#4f46e5",
    "avatar": null,
    "terms": false,
    "source": "playground"
}

Fieldset ​

json
{
    "id": null,
    "legend": "Account",
    "description": "Basic details for the new user.",
    "icon": null,
    "columns": 2,
    "class": null,
    "visibility": null,
    "fields": [ ... ]
}
KeyTypeDescription
idstring | nullHTML id.
legendstring | nullHeading. null renders a plain group.
descriptionstring | nullText under the legend.
iconstring | nullStep icon from Fieldset::icon(), used by wizards.
columnsnumberGrid columns (at least 1).
classstring | nullExtra classes.
visibilityVisibilityCondition[] | nullConditions, or null when always visible.
fieldsFieldSchema[]Authorized fields.

Field ​

Every field has these common keys:

json
{
    "component": "TextInput",
    "name": "phone",
    "label": "Phone",
    "help": null,
    "placeholder": null,
    "required": true,
    "disabled": false,
    "readonly": false,
    "autofocus": false,
    "columnSpan": null,
    "class": null,
    "visibility": [
        {
            "field": "contact_method",
            "operator": "=",
            "value": "phone",
            "negate": false
        }
    ],
    "clearWhenHidden": true,
    "clearable": false,
    "emptyValue": "",
    "type": "tel",
    "minLength": null,
    "maxLength": null,
    "min": null,
    "max": null,
    "step": null,
    "prefix": null,
    "suffix": null,
    "autocomplete": null
}
KeyTypeDescription
componentstringFrontend component name.
namestringData key (dot notation for nested). For Submit, the button text.
labelstringLabel text (generated from the name when not set).
helpstring | nullHelp text.
placeholderstring | nullPlaceholder.
requiredbooleanShows the * marker.
disabledbooleanDisabled state.
readonlybooleanRead-only state.
autofocusbooleanFocus on load.
columnSpannumber | nullGrid span inside the fieldset.
classstring | nullExtra classes on the field wrapper.
visibilityVisibilityCondition[] | nullConditions.
clearWhenHiddenbooleanReset to emptyValue when hidden.
clearablebooleanShow a × button that resets the value. Used by TextInput, Combobox, DatePicker, TimePicker, and ColorPicker.
emptyValueunknownThe field's empty value ([] for multi-value fields, { "start": "", "end": "" } for a date range).

Keys per field type ​

ComponentExtra keys
TextInputtype, minLength, maxLength, min, max, step, prefix, suffix, autocomplete
Textarearows, autoResize, minLength, maxLength, showCharacterCount
Hiddennone
Comboboxoptions, multiple, searchable, search ({ url, token, field } for searchUsing(), otherwise null). Select fields serialize as Combobox too.
Radiooptions, inline, columns, buttons
CheckboxtrueValue, falseValue
CheckboxGroupoptions, inline, columns, buttons
ToggletrueValue, falseValue, onLabel, offLabel
DatePickerwithTime, range, months, firstDayOfWeek, minDate, maxDate
TimePickerwithSeconds, minTime, maxTime, minuteStep
ColorPickerswatches
Slidermin, max, step, showValue, suffix
FileUploadmultiple, image, accept, maxSize, maxFiles
TagsInputsuggestions, maxTags, maxTagLength, reorderable
Blocksblocks (each: name, label, description, icon, columns, titleFrom, fields, defaults), addActionLabel, reorderable, addable, deletable, collapsible, collapsed, minItems, maxItems
RepeaterSame keys as Blocks, with exactly one entry in blocks (the item: its label, columns, titleFrom and fields)
KeyValuekeyLabel, valueLabel, keyPlaceholder, valuePlaceholder, addActionLabel, reorderable, addable, deletable, editableKeys, maxItems
Linkstructured, withLabel, withTarget, requireScheme, allowedSchemes, labelPlaceholder
Slugfrom, separator, lowercase, maxLength, prefix
OtpInputlength, alphanumeric, masked, groupSize, autoSubmit
Composerattachments, accept, maxFiles, maxSize, maxLength, submitOnEnter, sendLabel, rows, quickReplies
Headingtext, level
Texttext
Htmlhtml
Separatorspacing
Callouttitle, body, tone, icon
SubmitprocessingLabel, variant, size, fullWidth, icon, iconPosition, intent ({ key, value } or null)

FileUpload.accept is already in HTML form: extensions become ".pdf,.docx", and image() without extensions becomes "image/*".

Some keys are adjusted when the form is serialized:

  • DatePicker.withTime is always false when range is true.
  • DatePicker.months is 1 or 2. It becomes 2 when range() is called while it is still 1.
  • DatePicker.firstDayOfWeek is 0 (Sunday) to 6 (Saturday).
  • TimePicker.minuteStep is between 1 and 30 (default 5).
  • TagsInput.suggestions are strings; reorderable defaults to true.
  • Blocks data is a list of { "type": "section", "data": { ... } } blocks; each block's fields use the same schema as top-level fields, with names relative to the block.
  • Repeater data is a plain list of row objects, like [{ "question": "...", "answer": "..." }]; addActionLabel defaults to "Add " plus the item label in lower case.
  • Link data is a string, or { "url": "" } plus the enabled label / target keys when structured is true.
  • Composer data is { "message": "", "attachments": [] }.
  • OtpInput.length is between 2 and 12.
  • Heading, Text, Html, Separator and Callout have a generated name, columnSpan: 12, and no entry in data.
  • KeyValue data is a list of { "key": "...", "value": "..." } rows; addActionLabel defaults to "Add row".

For example, a range picker and a tags field:

json
{
    "component": "DatePicker",
    "name": "stay",
    "withTime": false,
    "range": true,
    "months": 2,
    "firstDayOfWeek": 1,
    "minDate": null,
    "maxDate": null,
    "emptyValue": { "start": "", "end": "" }
}
json
{
    "component": "TagsInput",
    "name": "tags",
    "suggestions": ["travel", "carry-on"],
    "maxTags": 5,
    "maxTagLength": null,
    "reorderable": true,
    "emptyValue": []
}

Both excerpts leave out the common keys.

Options ​

Option fields (Combobox, Radio, CheckboxGroup) always send a normalized list:

json
"options": [
    {
        "value": "email",
        "label": "Email",
        "description": "We reply within a day.",
        "disabled": false
    },
    {
        "value": "phone",
        "label": "Phone",
        "description": "Business hours only.",
        "disabled": false
    }
]

Submit ​

json
{
    "component": "Submit",
    "name": "Create user",
    "label": "Create user",
    "help": null,
    "placeholder": null,
    "required": false,
    "disabled": false,
    "readonly": false,
    "autofocus": false,
    "columnSpan": null,
    "class": null,
    "visibility": null,
    "clearWhenHidden": false,
    "clearable": false,
    "emptyValue": "",
    "processingLabel": "Creating…"
}

Visibility condition ​

json
{ "field": "contact_method", "operator": "=", "value": "phone", "negate": false }
KeyTypeDescription
fieldstringThe field whose value is checked (dot notation allowed).
operatorstringOne of the visibility operators.
valueunknownCompared value. Enums are sent as their backing value.
negatebooleantrue for hiddenWhen().

TypeScript ​

The same shapes are exported as types: FormSchema, FieldsetSchema, FieldSchema, FieldOption, VisibilityCondition, DateRangeValue ({ start: string; end: string }), and FormErrors (Record<string, string>).

Field-specific types are exported too: BlocksSchema, BlockSchema, BlockItem, KeyValueSchema, KeyValueRow, LinkSchema, LinkValue, SlugSchema, OtpInputSchema, ComposerSchema, ComposerValue, DisplayFieldSchema, CalloutTone, SubmitVariant, SubmitSize and WizardSettings.