FormRenderProps

Represents the props that are passed to the render option component of the Form.

NameTypeDefaultDescription

allowSubmit

boolean

Indicates if the Form is ready to be submitted.

  • If allowSubmit is set to true and the Form is valid, the user will be able to submit the form.
  • If allowSubmit is set to true and the Form is not valid, the user will be able to set the touched and visited state of all fields to true.

touched and visited 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.

submitted

boolean

Indicates if the Form is successfuly submitted. Useful for detecting if user is leaving the form before saving changes.

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.