Overview
========
There are three central concepts in React Forms — form schemas, form components
and input components.
Form Schemas
------------
Form schemas are high level declarative descriptions of how forms should
operate: what's shape of the data form should handle, how to render any specific
field, how to validate user input and so on.
Form schemas don't do anything by themselves they are just metadata and are
subject to interpretation by form components (see :ref:`form-components`) of React Forms library.
A basic example of a form schema looks like::
function Person(props) {
props = props || {}
return (
)
}
var family = (
)
.. note::
:class: inline
The example uses JSX syntax to describe schema (similar to how React uses JSX
to describe UI) but it's not required.
You can read more about schemas on :doc:`schema` documentation page.
.. _form-components:
Form Components
---------------
Form components are React components which interpret form schemas to render
form UI and handle validation and data flow. They are designed to be as generic
as possible and so to be reusable across as many form schemas as possible.
There are four types of form components, each for different schema type and one
component which serves as a form controller: ``
``, ````,
```` and ````.
The functional scope of form components is to decide where to render ```` elements, when to show hide any specific field, how to handle array values
and so on. What falls outside of this is how users enter form values, this is
handled by input components (see :ref:`input-components`) instead.
~~~~~~~~
```` component is the only stateful component provided by React Forms.
It serves as a form controller, holds form value and validation state and
updates it accordingly.
Every change made by user through an input component is propagated up to the
form component.
~~~~~~~~~
```` component is used to represent scalar values (strings, numbers,
dates and so on), values which correspond to schema nodes of type ``Property``.
This component renders input component and corresponding ``