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.
storybookobject
{ name: "string" }
{ name: "node" }
object
{ name: "string" }
{ name: "node" }
formField.kind.label
can be used.string
"survey"
function
(value) => {}
function
() => {}
function
({ value, touched }) => {}
function
() => {}
At its core, the Form component is a regular <form> element. Thus, both DOM and React properties, methods, and events are accessible. To read up on all of the possible DOM attributes and types available for form elements, check out this MDN Web Documents page. To learn more about DOM events and methods, you can read more on the MDN Web Events documentation page.
Also, feel free to read about the types of React events available, or see how DOM attributes change in React. Working in tandem with Styled Components, you also have access to the as property.