Form
Functions
Form
▸ Form<Values>(props): Element
A Form is reponsible for wrapping the Fields that you want to render. It will keep track
of the form state and act as a context/provider for various hooks used within the Form's
component tree.
Example Usage:
function UserProfile() {
return (
<Form name="UserProfile" initialValues={{ firstName: "" }}>
<TextField name="firstName" required pattern={/\w+/} as={({ input }) => <input {...input} />} />
</Form>
);
}
Type parameters
| Name | Type | Description |
|---|---|---|
Values | extends FormzValues | FormzValues - The shape of the forms state i.e. the form data. |
Parameters
| Name | Type | Description |
|---|---|---|
props | WebFormProps<Values> | FormProps - The react props for the form component. |
Returns
Element
Defined in
packages/react-formz-web/src/components/Form/Form.tsx:54
PersistedForm
▸ PersistedForm<Values>(__namedParameters): Element
A form whose state will not be deleted from the store when unmounted.
This is useful for forms that may span multiple pages like wizards or signup forms on mobile devices that might span multiple navigation routes.
Type parameters
| Name | Type |
|---|---|
Values | extends FormzValues |
Parameters
| Name | Type |
|---|---|
__namedParameters | PropsWithChildren<WebFormProps<Values>> |
Returns
Element