🆕 Composition Helpers
Added (#3055) the following composition API functions, these functions should make it easier to build specific specialized components for your forms (indicators, behaviors, etc...)
useResetForm
allows you to reset the form from anywhere in the component treeuseFieldErrors
returns a computed ref to any form field's error messageuseFormErrors
returns a computed ref of the entire form's error baguseIsFieldDirty
returns a computed boolean ref for the field's dirty statususeIsFieldTouched
returns a computed boolean ref for the field's touched statususeIsFormDirty
returns a computed boolean ref for the form's dirty status (if any field is dirty)useIsFormTouched
returns a computed boolean ref for the form's touched status (if any field is touched)useIsFieldValid
returns a computed boolean ref for a field's valid statususeIsFormValid
returns a computed boolean ref if the form is validuseIsSubmitting
returns a computed boolean if the form is submittinguseValidateField
returns a function that validates the specified fielduseValidateForm
returns a function that validates the context formuseSubmitCount
returns the submission attempts count done by the useruseFieldValue
returns a specific field's current valueuseFormValues
returns the values of the form's fields
💥 Breaking Changes
- Changed the return result of
validate()
for the<Form />
anduseForm()
, instead of a boolean it now returns an object containingerrors
object andvalid
boolean flag, this should make the function more useful.