Example
form-with-sections.tsx
Props
string
required
The title of the section. It will be displayed in a stronger font than the content of the section.
React.ReactNode
required
The text (or components) content of the section.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
The legacy app.ts layout is deprecated. New apps use the folder-based layout under src/app/; convert existing apps with the migration guide.
A section of UI with a title. It can be thought of like a <div/> in DOM.
import {Section} from "attio/client"
import React from "react"
import {Forms, useForm, showToast, Section} from "attio/client"
export function FormWithSectionsDialog() {
const {Form, SubmitButton, TextInput} = useForm(
{
firstName: Forms.string(),
lastName: Forms.string(),
street: Forms.string(),
city: Forms.string(),
},
{
firstName: "",
lastName: "",
street: "",
city: "",
},
)
return (
<Form
onSubmit={async (values) => {
await showToast({
title: "Form submitted",
variant: "success",
text: JSON.stringify(values),
})
}}
>
<Section title="Personal information">
<TextInput label="First name" name="firstName" />
<TextInput label="Last name" name="lastName" />
</Section>
<Section title="Address">
<TextInput label="Street" name="street" />
<TextInput label="City" name="city" />
</Section>
<SubmitButton label="Submit" />
</Form>
)
}
Was this page helpful?