Components
BaseForm
A schema-driven form: describe sections and fields as data and it renders the inputs, validation, layout, steps and actions.
Page layout
Submit it empty to see the error summary. Turn on discounts to reveal the field that depends on it (visibleIf).
Stepper
layout="stepper" splits the sections into steps; contained puts steps, fields and actions in one card, as the onboarding example does.
Tabs
Layouts
Layout | Use it for |
|---|---|
panel | Inside a BaseFormPanel drawer or dialog. The default. |
page | A full page with the sections stacked. |
aside | A page with a section navigation and progress on the side (BaseFormNav). |
tabs | One section per tab, with error counts (BaseFormTabs). |
stepper | One section per step, with back and next (BaseFormSteps). |
Fields
Every field has a key (its name in the values), a type and the options of that type. Common options are label, hint, info, placeholder, cols (out of 12), rules, clearable, disabled, readonly, visibleIf and props (extra props passed to the input).
Type | Renders | Own options |
|---|---|---|
text, email, password, tel, url | BaseTextField / BasePasswordField | prefix, suffix, counter, autocomplete, inputmode, showStrength |
textarea | BaseTextarea | rows, counter |
number, currency | BaseNumberInput | min, max, step, precision, prefix, suffix |
select, autocomplete | BaseSelectInput / BaseAutocomplete | items, multiple, chips, loading |
radio, checkbox, toggle | BaseRadioGroup / BaseCheckboxGroup / BaseToggleGroup | items, inline, mandatory |
switch | BaseSwitch | text |
date, dateRange | BaseDateInput / BaseDateRangeField | min, max |
range | BaseRangeSlider | min, max, step, prefix, suffix |
file | BaseFileInput | accept, multiple |
custom | Your component | component |
Rules
rules accepts names (required, accepted, email, phone, url, numeric, integer, positive, password), tuples (['min', 1], ['maxLength', 80], ['pattern', '^[a-z]+$'], ['match', 'password']) or any function (value, values) => true | string. Fields without required are marked optional automatically.
API
Props
Name | Type | Default | Description |
|---|---|---|---|
fields | FormField[] | — | The fields, when you do not need sections. |
sections | FormSection[] | — | The sections, each { key, title?, description?, icon?, fields, visibleIf? }. |
layout | FormLayout | "panel" | panel, page, aside, tabs or stepper. |
loading | boolean | — | Shows the submit button loading and blocks the form. |
readonly | boolean | — | Shows the values without letting the user edit them. |
disabled | boolean | — | Disables every field and action. |
submit-disabled | boolean | — | Disables only the submit button, for example while a required name is still empty. |
submit-label | string | — | The text of the submit button. |
cancel-label | string | — | The text of the cancel button. |
hide-actions | boolean | — | Hides the footer, for forms you submit from outside. |
dirty-actions | boolean | — | Shows the footer only when there are unsaved changes, as a save bar. Call markClean() after saving. |
hide-cancel | boolean | — | Removes the cancel button. |
show-create-another | boolean | — | Adds a “Create another” checkbox that keeps the panel open after submitting. |
hide-error-summary | boolean | — | Hides the summary of invalid fields. |
confirm-leave | boolean | true | Asks before closing or leaving with unsaved changes. |
draft-key | string | — | Saves a draft in localStorage under this key and offers to restore it. |
steps-orientation | FormStepsOrientation | "horizontal" | horizontal or vertical steps in the stepper layout. |
contained | boolean | false | Wraps steps, fields and actions in a single card. |
v-model | FormValues | {} | The values, keyed by field key. |
Slots
Name | Slot props | Description |
|---|---|---|
#actions | { loading: boolean; isDirty: any; submit: () => Promise<void>; cancel: () => void; reset: (next?: FormValues | undefined) => void; } | Replaces the footer buttons; receives loading, isDirty, submit, cancel and reset. |
#actions-start | — | Secondary or destructive actions on the left of the footer, such as Delete. |
Events
Name | Payload | Description |
|---|---|---|
@update:modelValue | [value: FormValues] | The values changed. |
@submit | [values: FormValues, context: { createAnother: boolean; }] | The form is valid; receives the values and { createAnother }. |
@cancel | — | The user pressed Cancel. |
Set server errors through a template ref: formRef.value?.setErrors(resolveSubmitError(error).fieldErrors). The Forms guide has the full flow.