Skip to main content

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

onSubmit
object
Action object to execute when form is valid and submitted.
defaultValues
object
Initial values for fields.
gap
string
default:"md"
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>