Skip to content

FormModel ​

Overview ​

This component is a form model that renders fields based on the configuration for the model.

Theme entry: FormModel

Props ​

NameTypeRequiredDefaultDescription
themeOverrideObjectnullA partial ThemeObject keyed by component name, merged over this component's theme and provided to descendants.
appstringyesDjango app label that owns the model.
modelstringyesDjango model name to render a form for.
viewstringundefinedView identifier used to select view-specific form configuration; uses the default configuration when omitted.
fieldsarrayundefinedField names to render; overrides the configuration default for this view.
expandarrayundefinedField names to render in expanded (inline) mode.
computedFieldsarrayundefinedField names to render as computed fields: read-only, in FormField, and outside the form context. Replaces the model config computedFields list for this form.
variantstring"default"Visual variant for the theme system. A function-form FormModel theme entry receives it as { variant }, so a project can register an alternate form style for each variant.
fieldComponentsobjectundefinedMap of field paths to async functions returning an override field component.
fieldPropsobjectundefinedMap of field paths to additional props passed to the field component.
fieldDetailsobjectundefinedMap of field paths to field detail overrides merged with server configuration.
expandDetailsobjectundefinedMap of expand field paths to detail overrides.
widgetComponentsobjectundefinedMap of field paths to async functions returning an override widget component.
widgetPropsobjectundefinedMap of field paths to additional props passed to the widget component.

Slots ​

NameScopedDescription
before-fieldsyes
form-level-chores
fieldsyesfields Replace the default field loop. Render each field with FormModelField so the per-field slots reach it.
after-fieldsyes

Full slot reference

Source ​

client/lib/form/form-model/FormModel.vue