Form
Form manages the collective state of its FormFields. There are two primary ways of managing Form state, each of which is outline below.
controlled
A controlled Form is similar to a controlled input element in React. The value state is held by the caller and connected to the Form via value
and onChange
.
uncontrolled
An uncontrolled Form is similar to an uncontrolled input element in React. The value state is held by the Form.
storybookAn object representing any errors in the data. Their keys should match the keys in the value object.
{"name": "string"}
{"name": "node"}
An object representing any information details in the data. Their keys should match the keys in the value object.
{"name": "string"}
{"name": "node"}
Function that will be called when any fields are updated.
The fields must have a non-null name
property assigned.
(value) => {}
Function that will be called when the form is reset. The single argument is the event provided by react.
() => {}
Function that will be called when the form is submitted. The
single argument is an event containing the latest value object
via event.value
and an object indicating which fields were
touched via event.touched
.
({ value, touched }) => {}
Function that will be called when the form is validated. The
single argument is an event containing the latest error object
via validationResults.errors
and info object via
validationResults.infos
.