You are required to render one – and only one – of these to make your form work.All inputs must be inside of the <Form />.
Example
import React from "react"
import {Forms, useForm, showToast} from "attio/client"
export function FormDialog() {
const {Form, SubmitButton, TextInput} = useForm(
{
firstName: Forms.string(),
lastName: Forms.string(),
},
{
firstName: "",
lastName: "",
}
)
return (
<Form
onSubmit={async (values) => {
await showToast({
title: "Form submitted",
variant: "success",
text: JSON.stringify(values),
})
}}
>
<TextInput label="First name" name="firstName" />
<TextInput label="Last name" name="lastName" />
<SubmitButton label="Submit" />
</Form>
)
}
Props
onSubmit
(values) => void | Promise<void>
required
What to do with the form values on submit. Typically you will call a server function.In TypeScript, the values will be strongly typed to match your form schema.
The contents of your form, usually layout and input components.
A form must contain one – and only one – [``](./submit-button) as a direct child.