API reference
Forms
Rules, submit handling, schema-driven forms and the input helpers behind every Base field.
The Forms guide walks through a complete form.
useFormRules()
Reusable Vuetify rules with translated messages: required, accepted, email, phone, url, numeric, integer, positive, min, max, minLength, maxLength, pattern, password, sameAs.
useFormRules(): { required: (message?: string) => ValidationRule; accepted: (message?: string) => ValidationRule; email: (message?: string) => ValidationRule; phone: (message?: string) => Validat…requiredacceptedemailphoneurlnumericintegerpositiveminmaxminLengthmaxLengthpatternpasswordsameAsuseFormSubmit()
Validates, focuses the first error, prevents double submits and maps server errors to fields.
useFormSubmit(values: MaybeRefOrGetter<TValues>, onSubmit: (values: TValues) => Promise<TResult>, options: UseFormSubmitOptions<TResult> = {}): { formRef: any; isSubmitting: any; isSuccess: any; formError: any; fieldErrors: any; errorCount: any; submit: () => Promise<boolean>; focusNextError: () => Promise<void>; resetVal…formRefisSubmittingisSuccessformErrorfieldErrorserrorCountsubmitfocusNextErrorresetValidationuseSubmitErrors()
resolveSubmitError(error) turns any error into { message, fieldErrors }, for BaseForm.setErrors().
useSubmitErrors(): { resolveSubmitError: (error: unknown) => { message: any; fieldErrors: { [k: string]: any[]; }; }; }resolveSubmitErrorfocusInvalidField()
Focuses the n-th invalid field inside a form element.
focusInvalidField(root: HTMLElement | null | undefined, index = 0): Promise<void>
useFormValidation()
The validation engine of BaseForm: resolves rule specs, collects errors and tells whether a field is required.
useFormValidation(): { isEmpty: any; resolveRules: (field: FormField, values: FormValues) => ((value: unknown) => string | true)[]; fieldErrors: (field: FormField, values: FormValues) => string[]; col…isEmptyresolveRulesfieldErrorscollectErrorsisRequireduseFormSchema()
Schema helpers of BaseForm: visible sections and fields, column sizes, default and initial values, section status.
useFormSchema(): { normalizeSections: (fields?: FormField[], sections?: FormSection[]) => FormSection[]; resolveSections: (sections: FormSection[], values: FormValues) => FormSection[]; sectionFie…normalizeSectionsresolveSectionssectionFieldsresolveFlagfieldColsdefaultValueinitialValuessectionStatususeFormSectionStatus()
Texts, states and progress of form sections for steps, tabs and the aside navigation.
useFormSectionStatus(): { statusText: (section: FormSectionStatus) => any; statusLabel: (section: FormSectionStatus) => string; sectionState: (section: FormSectionStatus) => FormStepState; stateStyle: (s…statusTextstatusLabelsectionStatestateStylestateTextsectionProgresssectionItemsuseEditPanel()
State of a create/edit BaseFormPanel: isOpen, editingId, values, create(), edit(id, values) and close().
useEditPanel(blank: () => FormValues): { isOpen: any; editingId: any; values: any; create: (initial?: FormValues) => void; edit: (id: string, initial: FormValues) => void; close: () => void; }isOpeneditingIdvaluescreateeditcloseuseInputStyles()
The look of every field: variant, density, radius, colour and the label class. Edit it to restyle all inputs.
useInputStyles(): { inputLabelClass: string; inputStyle: Partial<Partial<{ style: import("vue").StyleValue; focused: boolean; errorMessages: string | readonly string[] | null; maxErrors: string | n…inputLabelClassinputStyleselectInputStyleselectionControlStylecheckboxListItemClassuseInputPlaceholder()
Default placeholders by input kind, such as [email protected] for emails.
useInputPlaceholder(kind?: InputPlaceholderKind): { resolvePlaceholder: (attrs: Record<string, unknown>) => any; resolveTextDefaults: (attrs: Record<string, unknown>) => { placeholder: string | undefined; autocomplete: string | u…resolvePlaceholderresolveTextDefaultsuseInputValidity()
Mirrors the validity of a Vuetify field into aria-invalid.
useInputValidity(): { fieldRef: any; ariaInvalid: any; }fieldRefariaInvalidusePasswordStrength()
Scores a password from 0 to 4 with a label key and colour, for BasePasswordField show-strength.
usePasswordStrength(password: MaybeRefOrGetter<string | null | undefined>): any