Genesis
@beta

FormPage

FormPage — a titled form: header, validation summary, a body of sections, and a sticky action bar. It renders a real `<form>` and forwards `onSubmit` (and every other form attribute), so a plain `type="submit"` button in `actions` submits it with no `form=` wiring. That is what keeps it usable for a HAND-WRITTEN form — `react-hook-form`, `useActionState`, or an uncontrolled `<form action>` — rather than only for one of them. **Do not put a `ResourceForm` inside it.** `ResourceForm` renders its own `<form>`, and nesting one form in another is invalid HTML: the browser drops the inner element, SSR and hydration disagree about the tree, and a submit fires both handlers. `ResourceForm` is the data-bound *alternative* to this template — it already answers "bind a form to a resource", with a `layout="page"` mode of its own — not something this one wraps. ```tsx <FormPage title="New engagement" description="Both parties will be notified." errors={submitFailed ? "Fix the highlighted fields." : undefined} onSubmit={handleSubmit(onValid)} actions={ <> <Button variant="ghost" type="button" testID="cancel">Cancel</Button> <Button type="submit" testID="save">Save</Button> </> } > <Section title="Basics"> <FormField label="Name">…</FormField> </Section> </FormPage> ``` Sections are just children — `Section` is the natural one, but any node works. The body spaces them at `gap-8`, wider than the page's own `gap-6`, so section boundaries read as boundaries rather than as more fields. The sticky bar needs a scrolling ancestor to stick to, which `AppShell`'s `<main>` provides. It renders only when `actions` is set: an empty sticky strip is a border floating over the content for no reason. This is a **layout** — it positions a form, it does not submit one. Binding fields to a resource is `ResourceForm`'s job (`@marktiderman/genesis-ui/data`), which is already the one home for that question. The header row is markup, not a component, and deliberately not `PageHeader` — see `./detail-page` for the measured reasons composing it was rejected across all four templates (`title: string`, and a 6x jump in the emitted per-component closure plus a new `radix-ui` runtime dependency for chrome none of them render). Width is left to `Container` for the one-home reason — wrap, don't duplicate.

packages/ui/src/components/layout/form-page.tsx

Import
Subpath export: @marktiderman/genesis-ui/layout
import { FormPage } from "@marktiderman/genesis-ui/layout";
Components
Auto-generated from TypeScript source via react-docgen-typescript.

FormPage

FormPage — a titled form: header, validation summary, a body of sections, and a sticky action bar. It renders a real `<form>` and forwards `onSubmit` (and every other form attribute), so a plain `type="submit"` button in `actions` submits it with no `form=` wiring. That is what keeps it usable for a HAND-WRITTEN form — `react-hook-form`, `useActionState`, or an uncontrolled `<form action>` — rather than only for one of them. **Do not put a `ResourceForm` inside it.** `ResourceForm` renders its own `<form>`, and nesting one form in another is invalid HTML: the browser drops the inner element, SSR and hydration disagree about the tree, and a submit fires both handlers. `ResourceForm` is the data-bound *alternative* to this template — it already answers "bind a form to a resource", with a `layout="page"` mode of its own — not something this one wraps. ```tsx <FormPage title="New engagement" description="Both parties will be notified." errors={submitFailed ? "Fix the highlighted fields." : undefined} onSubmit={handleSubmit(onValid)} actions={ <> <Button variant="ghost" type="button" testID="cancel">Cancel</Button> <Button type="submit" testID="save">Save</Button> </> } > <Section title="Basics"> <FormField label="Name">…</FormField> </Section> </FormPage> ``` Sections are just children — `Section` is the natural one, but any node works. The body spaces them at `gap-8`, wider than the page's own `gap-6`, so section boundaries read as boundaries rather than as more fields. The sticky bar needs a scrolling ancestor to stick to, which `AppShell`'s `<main>` provides. It renders only when `actions` is set: an empty sticky strip is a border floating over the content for no reason. This is a **layout** — it positions a form, it does not submit one. Binding fields to a resource is `ResourceForm`'s job (`@marktiderman/genesis-ui/data`), which is already the one home for that question. The header row is markup, not a component, and deliberately not `PageHeader` — see `./detail-page` for the measured reasons composing it was rejected across all four templates (`title: string`, and a 6x jump in the emitted per-component closure plus a new `radix-ui` runtime dependency for chrome none of them render). Width is left to `Container` for the one-home reason — wrap, don't duplicate.

PropTypeDefaultDescription
title*ReactNode—Page title. Rendered as the page's single `<h1>`.
actionsReactNode—Submit / cancel controls. Rendered in a bar that sticks to the bottom of the scroll container, so the primary action stays reachable on a form longer than the viewport.
descriptionReactNode—Supporting copy under the title — what this form is for.
errorsReactNode—Validation summary. Rendered in a destructive `Alert` above the fields when set, so the summary announces itself (`role="alert"`) and sits where a keyboard user lands after a failed submit. Pass a list, a sentence, or your own markup — the copy is yours.
testIDstring—Stable test/automation selector (emitted as `data-testid`).