import {Section} from "attio/client"

Example

form-with-sections.tsx
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>
	);
}

Props

title
string
required
The title of the section. It will be displayed in a stronger font than the content of the section.
children
React.ReactNode
required
The text (or components) content of the section.