Form
The Form component wraps input fields and handles data submission.
Usage
<Form onSubmit={{ type: "api.post", payload: { endpoint: "/users" } }}>
<Input name="name" label="Name" />
<Input name="email" label="Email" />
<Button type="submit" label="Submit" />
</Form>
Props
Action object to execute when form is valid and submitted.
Initial values for fields.
Spacing between form fields.
Examples
Profile Update
<Form
defaultValues={{ name: user.name, bio: user.bio }}
onSubmit={{ type: "updateProfile" }}
>
<Input name="name" label="Name" required />
<Textarea name="bio" label="Bio" />
<Button label="Save Changes" />
</Form>