FormItemThis is a React component
SourceThis is a React component
import { FormItem } from "@prestojs/final-form";
FormItem(props)
Wrapper around Field from react-final-form that determines the widget to use based on the field.
Must be used within a ViewModelForm
.
If component
, render
or children
are passed they will be used instead of selecting a widget
based on the field type.
Usage:
// Fill out label, help text, required indicator and the field widget component to use based// on the User email field<Form.Item field={User.fields.email} />// The equivalent thing writing out everything explicitly:<Form.Itemrequired={User.fields.email.required}label={User.fields.email.label}help={User.fields.email.help}><Form.Field field={User.fields.email} /></Form.Item>
You can override any prop that is autofilled from the field:
<Form.Item field={User.fields.email} label="Email Address" />
Or you can specify everything, including the field
<Form.Item label="Email" help="Please double check your email"><Form.Field field={User.fields.email} /></Form.Item>
Parameter | Type | Description | |
---|---|---|---|
* | props | FormItemProps |