DXForm

DXForm

The canonical form renderer. Drive it with field definitions; add tabs when you need a multi-tab editor. Flat and tabbed forms share one engine (DXField), so every field type, conditional field, per-field slot override, async option, and nested repeater works the same in both.

It works with the fetch-based useForm composable (no Inertia required) and accepts either a useForm return or a defineForm return (with the latter, fields may be omitted).

Live Examples

Product Editor

A tabbed form with conditional fields, a currency input, and auto-switching to the tab containing the first validation error.

Name
Price
£
SKUFormat: ABC-123
Stock on hand

Props

Name Click to sort ascendingType Required Click to sort ascendingDefault Description
formUseFormReturn<any> | DefineFormReturn<any>Yes-Form instance from useForm, or the { form, fields } object from defineForm.
fieldsFieldDefinition[]No-Field definitions. Optional when form is a defineForm return (taken from it).
tabsFormTab[]No-Tab definitions. When omitted, a flat single-column form renders.
contextRecord<string, any>No-Extra context merged under the live form data when evaluating predicates (label/hint/when/disabled).
activeTabnumber (v-model)No0Active tab index. Two-way bindable via v-model:active-tab.
autoErrorTabbooleanNotrueAuto-switch to the first tab containing a validation error.
submitTextstringNoSubmitSubmit button text.
submitLoadingTextstringNoSubmitting...Submit button loading text.
showSubmitbooleanNotrueShow the submit button.

Events

Name Click to sort ascendingParameters Description
submitnoneEmitted when the form is submitted (run your form.post/put in the handler).

Slots

Per-field slots are keyed by field key, e.g. #value(price) or #hint(sku).

Name Click to sort ascendingDescription Scoped Props
value(<key>)Replace a field's input control with custom markup.-
span(<key>)Full-width custom block for a field marked span: true.-
info(<key>)Rich info block rendered below the field.-
hint(<key>)Override the hint text rendered below the field.-
repeater-row(<key>)Custom row layout for a repeater field.-
tab-content(<key>)Replace the entire body of a tab.-
tab-before(<key>)Content rendered before a tab's fields.-
tab-after(<key>)Content rendered after a tab's fields.-
footerContent rendered after the form body.-

Field definitions

Each field is a FieldDefinition. Supported type values:

TypeRenders
text, email, password, number, url, tel, date, datetime-local, datetime, timeNative input
textareaMulti-line input
selectDropdown (sync options or async optionsLoader)
radioRadio group
checkboxSingle checkbox
currency, percentageNumeric input with a £/% affix
image, fileFile input (image shows a preview)
componentRenders your field.component (escape hatch)
repeaterNested, repeatable sub-form (see DXRepeater)

Common options beyond key/type/label:

Name Click to sort ascendingType Required Click to sort ascendingDefault Description
label / hintstring | (model) => stringNo-Static or model-derived label and hint text.
whenboolean | (model) => booleanNotrueConditional visibility, evaluated reactively against the live model.
readonlyboolean | (model) => booleanNofalseRender the field read-only.
disabled / disabledWhenboolean | (model) => booleanNofalseDisable the field, statically or from the model.
options / optionsLoaderFieldOption[] | (model) => Promise<FieldOption[]>No-Select/radio options, synchronous or async. Set reloadOptionsOnChange to refetch on model change.
spanbooleanNofalseRender full-width, delegating content to the #span(<key>) slot.
currencySymbol / accept / step / min / maxstring | numberNo-Type-specific options (currency symbol, file accept, numeric bounds).

A FormTab is { key, label?, fieldKeys, when?, lazy? }. Tabs whose when is false — or that have no visible fields and no custom tab slot — are hidden automatically.

Extended Component

This is a custom component that extends beyond simple Bootstrap Vue Next wrappers, providing additional functionality specific to Laravel dashboards.