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
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| name | String | yes | The field name, used as the path to look up and store the value in the form state. | |
| formModelName | String | undefined | The name of the form model for configuration lookup; usually provided by a parent field renderer. | |
| clearServerErrorDependents | Array | () => [] | Other fields whose server errors should be cleared when this field's value changes. | |
| validationDependencies | Array | () => [] | Other field paths this field depends on; their values are passed to validation and required functions. | |
| readOnly | Boolean | false | Whether the field is read-only; disables editing and skips required validation. | |
| required | Boolean | null | Whether the field is required. | |
| requiredMessage | String | "This field is required." | Error message shown when a required field is left empty. | |
| shouldRequireFn | Function | null | Custom function called with resolved field dependency values; determines whether the field should be required. | |
| isRequiredViolation | Function | null | Custom 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. | |
| validate | Function | null | Custom 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. | |
| label | String | null | The label shown next to the field; defaults to the field name when omitted. | |
| help | String | "" | Help text displayed alongside the field. | |
| modelValue | String|Number|Boolean|Array|Object | undefined | The field's external model value; used only in contextless mode (v-model binding). | |
| contextless | Boolean | false | When true, the field ignores any surrounding form context and manages its own state. | |
| validation | string | undefined | Validation type string dispatched to useFieldValidation (e.g. "text", "numeric", "date"). | |
| orientation | string | "vertical" | Controls whether the label and input stack vertically, sit side by side, or switch layout responsively. | |
| hidden | boolean | false | When 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
| Name | Scoped | Description |
|---|---|---|
field(fieldName)label | yes | Override the label content for this field. |
default | yes | |
field(fieldName)help | yes | Override the help/description text for this field. |
field(fieldName)errors | yes | Override the error messages for this field. |
field(fieldName)warnings | yes | Override the warning messages for this field. |
Events
| Name | Description |
|---|---|
update:modelValue | Emitted when the field value changes. |
Source
client/lib/form/form-model/FormField.vue