Skip to content

FormField

Overview

Generic form field component that provides field context, dispatches type-specific validation via a validation key, and optionally renders layout (label, description, errors) using the Field family.

Props

NameTypeRequiredDefaultDescription
nameStringyesThe field name, used as the path to look up and store the value in the form state.
formModelNameStringundefinedThe name of the form model for configuration lookup; usually provided by a parent field renderer.
clearServerErrorDependentsArray() => []Other fields whose server errors should be cleared when this field's value changes.
validationDependenciesArray() => []Other field paths this field depends on; their values are passed to validation and required functions.
readOnlyBooleanfalseWhether the field is read-only; disables editing and skips required validation.
requiredBooleannullWhether the field is required.
requiredMessageString"This field is required."Error message shown when a required field is left empty.
shouldRequireFnFunctionnullCustom function called with resolved field dependency values; determines whether the field should be required.
isRequiredViolationFunctionnullCustom function called with the current field value; checks whether the value violates the required rule. Defaults to rejecting null, undefined, empty string, false, and 0.
validateFunctionnullCustom validation function called with the current field value and resolved field dependency values; should return true when valid or an error message string when invalid.
labelStringnullThe label shown next to the field; defaults to the field name when omitted.
helpString""Help text displayed alongside the field.
modelValueString|Number|Boolean|Array|ObjectundefinedThe field's external model value; used only in contextless mode (v-model binding).
contextlessBooleanfalseWhen true, the field ignores any surrounding form context and manages its own state.
validationstringundefinedValidation type string dispatched to useFieldValidation (e.g. "text", "numeric", "date").
orientationstring"vertical"Controls whether the label and input stack vertically, sit side by side, or switch layout responsively.
hiddenbooleanfalseWhen true, suppresses the Field layout shell (label, description, errors). Used by filter fields (which provide their own heading) and injected automatically by useFieldRenderer in fieldset contexts.

Slots

NameScopedDescription
field(fieldName)labelyesOverride the label content for this field.
defaultyes
field(fieldName)helpyesOverride the help/description text for this field.
field(fieldName)errorsyesOverride the error messages for this field.
field(fieldName)warningsyesOverride the warning messages for this field.

Full slot reference

Events

NameDescription
update:modelValueEmitted when the field value changes.

Full event reference

Source

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

Documents matching: server v3.0.0a1.post1client v3.0.0-alpha.2