Enterprise form primitives for consistent labeling, hint/error messaging, accessibility wiring, and premium production layouts. Use FormSection for grouped surfaces, FormRow for responsive columns, and FormFooter for actions.
Premium grouped form with header, description, actions, responsive rows, framed fields, and a footer action bar.
import {
Form, FormSection, FormRow, FormField, FormLabel, FormControl, FormHint, FormFooter
} from "@/design-system/components/form";
import { Input } from "@/design-system/components/Input";
import { Button } from "@/design-system/components/Button";
export function Example() {
return (
<Form density="comfortable">
<FormSection
tone="primary"
variant="surface"
title="Student details"
description="Core identity fields used across scheduling, notes, and exports."
actions={<Button size="sm" variant="ghost">Auto-fill</Button>}
>
<FormRow columns={2}>
<FormField name="firstName" required framed>
<FormLabel>First name</FormLabel>
<FormControl asChild>
<Input placeholder="First name" autoComplete="given-name" />
</FormControl>
</FormField>
<FormField name="lastName" required framed>
<FormLabel>Last name</FormLabel>
<FormControl asChild>
<Input placeholder="Last name" autoComplete="family-name" />
</FormControl>
</FormField>
</FormRow>
<FormField name="studentId" required framed>
<FormLabel>Student ID</FormLabel>
<FormControl asChild>
<Input placeholder="e.g. THR-10429" autoComplete="off" />
</FormControl>
<FormHint>Used for audit logs, billing exports, and cross-system matching.</FormHint>
</FormField>
<FormFooter align="end" divider>
<Button size="sm" variant="ghost">Cancel</Button>
<Button size="sm" variant="primary">Save</Button>
</FormFooter>
</FormSection>
</Form>
);
}
Labels left, controls right. Ideal for settings, admin screens, and dense enterprise workflows.
import { Form, FormField, FormLabel, FormControl, FormHint } from "@/design-system/components/form";
import { Input } from "@/design-system/components/Input";
export function Example() {
return (
<Form layout="horizontal" density="compact">
<FormField name="timezone" framed>
<FormLabel>Timezone</FormLabel>
<FormControl asChild>
<Input placeholder="America/New_York" />
</FormControl>
<FormHint>Used for scheduling and reminders.</FormHint>
</FormField>
<FormField name="npi" framed>
<FormLabel optional>NPI</FormLabel>
<FormControl asChild>
<Input placeholder="Optional" />
</FormControl>
</FormField>
</Form>
);
}
Client-side preview demonstrating how FormError drives aria-describedby and invalid styling without server->client handler issues.
// See: src/app/[locale]/docs/components/form/_components/FormValidationPreview.tsxA "desktop tool" look for diagnostics panels: dashed border + grid background.
import { FormSection, FormRow, FormField, FormLabel, FormControl } from "@/design-system/components/form";
import { Input } from "@/design-system/components/Input";
export function Example() {
return (
<FormSection
variant="program"
tone="neutral"
title="Diagnostics"
description="Power-user configuration panel for admin/support workflows."
>
<FormRow columns={2}>
<FormField name="traceId" framed>
<FormLabel>Trace ID</FormLabel>
<FormControl asChild>
<Input placeholder="Paste a trace id" />
</FormControl>
</FormField>
<FormField name="sessionKey" framed>
<FormLabel>Session key</FormLabel>
<FormControl asChild>
<Input placeholder="Paste a session key" />
</FormControl>
</FormField>
</FormRow>
</FormSection>
);
}