Function: Form()
Form<
T
>(props
):Element
Defined in: components/Form.tsx:49
Form component that provides form state management, validation, and submission functionality. It creates a FormState instance and provides it to child components through React Context.
Type Parameters
T
T
extends object
The type of the form data object
Parameters
props
PropsWithChildren
<FormProps
<T
>>
Form component props
Returns
Element
JSX element that provides form context to children
Example
interface UserForm {
name: string;
email: string;
}
const MyForm = () => (
<Form<UserForm>
initialValues={{ name: '', email: '' }}
validationSchema={userSchema}
onSubmit={async (values) => {
await saveUser(values);
}}
>
<FormField name="name" />
<FormField name="email" />
<SubmitButton />
</Form>
);