Aside from useField
and useForm
and useFieldArray
, these are a collection of simple functions that you can use to opt-in specific parts of vee-validate features like form state and various actions you can perform on fields and forms.
Here are a few examples of what you can build with these functions:
- A custom submission progress component
- A custom error message component.
- A form validity indicators
- reset buttons or submit buttons
Here is a list of the functions available that you can use:
useFieldError
Gives access to a single field’s first error messageuseFormErrors
Gives access to the entire error bag of the formuseIsFieldDirty
If a field is dirtyuseIsFormDirty
If the form is dirty (form contains at least one dirty field)useIsFieldTouched
If a field is toucheduseIsFormTouched
If the form is touched (form contains at least one touched field)useIsFieldValid
If a field is validuseIsFormValid
If all fields are validated and validuseValidateField
Returns a function that validates a specific fielduseValidateForm
Returns a function that validates the entire formuseResetForm
Resets the form to its initial stateuseSubmitForm
Creates a submission function that validates and submits the form (even if noform
element is involved)useIsSubmitting
If the form is currently submittinguseIsValidating
If the form is currently validating by validate functionuseSubmitCount
The number of times the user attempted to submit the formuseFieldValue
Returns a specific fields’ current valueuseFormValues
Returns the current form field values
For more information about the functions, you can head over to the API reference and check them out.
Next Step
For TypeScript users, it is imperative that they strongly type their form values and the their submissions. This guide will show you how to use either zod or yup with vee-validate's typed schema utilities to get the most out of your schemas with TypeScript.
TypeScript - Typed SchemasInput and output types and how to make the most out of your form schemas with TypeScript.