FormRenderProps
Represents the props that are passed to the render
option component of the Form.
allowSubmit
boolean
Indicates if the Form is ready to be submitted.
- If
allowSubmit
is set totrue
and the Form is valid, the user will be able to submit the form. - If
allowSubmit
is set totrue
and the Form is not valid, the user will be able to set all fieldstouched
andvisited
state to true.
Useful for toggling the disabled state of the Submit button.
errors
KeyValue<string>
The key-value pair containing the current errors by field path, combined from both field and form level validators.
modified
boolean
Indicates if the Form is modified.
If any field is modified, modified
is set to true
.
The modified state of field is set to true
when the onChange
callback of the Field component is called for first time.
onChange
(name: string, options: { value: any; }) => void
A callback for emiting changes to a specific field without using the Field component (see example).
Use
onChange
only if you cannot achieve the desired behavior through the Field component.
onFormReset
() => void
A callback for resetting the Form.
onSubmit
(event: SyntheticEvent<any>) => void
A callback for submitting the Form.
Can be passed to the onClick
property of the Submit button.
touched
boolean
Indicates if the Form is touched.
If any field is touched, touched
is set to true
.
The touched state of field is set to true
when the onBlur
callback of the Field component is called or when the user tries to submit the form.
valid
boolean
Indicates if the Form is valid.
If any field is invalid, valid
is set to false
.
valueGetter
(name: string) => any
A callback for getting the value of a field without using the Field component (see example). Useful for creating and modifying the UI based on the field values.
visited
boolean
Indicates if the Form is visited.
If any field is visited, visited
is set to true
.
The visited state of field is set to true
when the onFocus
callback of the Field component is called or when the user tries to submit the form.