Optional
errorMap of custom error messages for the default validation methods.
Optional
maxMaximum length (in characters) for the field.
This will cause the form to be invalid if the field is longer than the given length, and an error message will be provided in UseFormReturn.errors.
To provide a custom error message, use errorMessages.
Optional
minMinimum length (in characters) for the field.
This will cause the form to be invalid if the field is shorter than the given length, and an error message will be provided in UseFormReturn.errors.
To provide a custom error message, use errorMessages.
Optional
multipleIf true
, handlers will treat the field as an array and not a single value.
If you supply an array as the initial value, this will be set to true
automatically.
Optional
patternA regular expression that the field must match.
This will cause the input to not update if the value does not match the given pattern. To cause a validation error for a pattern, use validate instead.
Optional
requiredIf true
, the field will be required.
This will cause the form to be invalid if the field is empty and an error message will be provided in UseFormReturn.errors.
To provide a custom error message, use errorMessages.
Optional
validateA custom validation function for the field.
If it returns an empty string, null
or undefined
, the field is valid.
Otherwise, the field is invalid and the returned string will be the error message.
The value of the field.
The error message, if any, or undefined/null if the field is valid.
Optional
onA callback for leaving focus from the input, which also contains the parsed value.
Never use onBlur
on the input field directly, or it will break validation for onBlur
.
Use this callback instead, which acts right after the input's onBlur
callback.
The input change event.
The parsed value of the field.
Optional
onA callback for changing the input, which also contains the parsed value.
Never use onChange
on the input field directly, or it will not work to update the form state.
Use this callback instead, which acts right after the input's onChange
callback.
The input change event.
The parsed value of the field.
Optional
parseGenerated using TypeDoc
Options for every field. See each property for more information.