Errors object
form.errors is an object of React nodes that contains validation errors:
Initial errors
Same as with initial values you can set initial form errors:
setErrors handler
setFieldError handler
The form.setFieldError handler sets the error for the given field:
clearErrors handler
The form.clearErrors handler clears all form errors:
clearFieldError handler
The form.clearFieldError handler clears the error for the given field:
Errors as React node
You can use any React node as an error message:
Note that errors that are false, null or undefined will be automatically removed:
FormErrors type
form.errors type is Record<string, React.ReactNode>. You can import a shorthand FormErrors type from @mantine/form:
You can also get the type directly from the form instance: