React Advanced Form
Getting started
Validation
GitHub
Search…
Introduction
General
Comparison
Migration guides
FAQ
Getting started
Installation
Creating fields
Creating form
Validation rules
Validation messages
Applying validation
Handle submit
Architecture
Argument properties
Referencing
Field lifecycle
Controlled fields
Reactive props
Validation
Getting started
Validation schema
Validation messages
High-order components
createField
Components
FormProvider
Form
Field.Group
Field
Recipes
Generating a form
Utilizing functions
Developers
Contributing
Powered By
GitBook
Creating form
React Advanced form treats any form as a composition of fields. Therefore, creating a form is a trivial procedure of rendering field components as the form's children.
Make sure you have
field components defined
before proceeding with this step.
Example
1
import
React
from
'react'
2
import
{
Form
}
from
'react-advanced-form'
3
4
/* Fields */
5
import
{
Input
,
Checkbox
}
from
'../fields'
6
7
export
default
class
ExampleForm
extends
React
.
Component
{
8
render
()
{
9
return
(
10
<
Form
>
11
<
Input
12
name
=
"
userEmail
"
13
required
/>
14
<
Input
15
name
=
"
userPassword
"
16
type
=
"
password
"
17
required
/>
18
<
Checkbox
19
name
=
"
termsAndConditions
"
/>
20
</
Form
>
21
)
22
}
23
}
Copied!
Getting started - Previous
Creating fields
Next - Getting started
Validation rules
Last modified
3yr ago
Copy link
Contents
Example