# The form screen

A form screen creates or edits one thing in a centred column of 640px, 960px with a summary beside the fields, and 1200px when that summary is a working result people read as they type. Save and Cancel sit in a footer outside the scroll, so they never move away, and a form is the one screen type that keeps its primary action out of the top bar.

Checked 2 December 2026. By Bohuslav Poláček. https://meadowstack.com/patterns/form/

*The form screen's slots in the kit, read from the repository when the site was built.*

From `packages/kit/src/components/screen.tsx` in the Meadowstack repository:

```ts
export type FormScreenProps = Base & {
  archetype: "form";
  /** Steps of a wizard (`WorkSteps`). */
  steps?: ReactNode;
  /** A summary column (totals, what happens next) widens the form to 960px. */
  summary?: ReactNode;
  /**
   * `wide`: the summary is a working result people read while they type (a price table, a sheet layout), 32rem
   * beside the fields from 1280px in a column of 1200px; narrower it stays 16rem.
   */
  summaryWidth?: "default" | "wide";
  /** Sections of fields. */
  children: ReactNode;
  /** The sticky footer: Save and Cancel. */
  footer: ReactNode;
};
```

## Anatomy

- **Header** (`header`): the title says what is made or changed ("New invoice", "Edit the quote"), with a fact in `meta` where one helps: Kestrel's draft invoice shows "No number yet", since the number comes when an accountant issues it. No description.
- **Steps** (`steps`): the steps of a wizard, `WorkSteps`. No form in the demo uses them; each is one column of sections.
- **Fields** (`children`): sections of fields, every input in a `Field` with a visible label.
- **Summary** (`summary`): the totals or what happens next. Beside the fields from 1024px and sticky while they scroll; after the fields on a phone.
- **Summary width** (`summaryWidth`): `"wide"` when the summary is a working result people read while they type, a price table or a sheet layout.
- **Footer** (`footer`, required): Cancel and Save.

## Width, scroll and how a record opens

| Form | Column | Summary |
| --- | --- | --- |
| Fields only | 640px | none |
| With a summary | 960px | 16rem beside the fields from 1024px |
| `summaryWidth="wide"` | 1200px | 32rem from 1280px, 16rem below that |

The fields scroll in the one `ScrollArea`, the summary stays in view beside them, and the footer sits under the scroll with a hairline above it, its buttons on the right. A form opens no records (decision 0001). What it needs from elsewhere comes to it: on Kestrel's invoice a client who is not there yet is added in a dialog and chosen at once.

## The footer and the primary action

The Screen moves every other type's primary action into the top bar, where it draws quiet; a form keeps it, and its save is the ink button on the screen, as the root `AGENTS.md` says: "A form's submit and the decision card's action are ink".

The fields, the summary and the footer are separate regions, so no `<form>` element wraps all three. The save button in the footer reaches the form through its `form` attribute (the starter's `formId`), and the dialog for a missing client sits outside the form element, since HTML does not allow a form inside a form.

On a phone the summary comes after the fields. Kestrel's invoice form puts the total beside Save in the footer, so it stays in reach while the fields scroll.

## Validation, leaving and loading

- One zod schema holds the rules and the messages, and the messages say what to do: "Choose a client.", never "Invalid value". Errors appear after the first try to save, then live.
- Leaving with unsaved changes asks first: the router's `useBlocker` with the kit's `useConfirm`.
- The result of each change shows while people type: Kestrel's summary shows the base, the VAT per rate and the amount to pay; Stonebridge's change order shows what the change does to the contract price.
- Loading, a failed load and no access keep the form's frame and title, so the page has its one h1 throughout and nothing jumps when the data arrives.

## The rules and where they are enforced

| Rule | Where it is enforced |
| --- | --- |
| Every form has a footer | the type: `footer` is required |
| No description under the title | the type: the header has no slot for one |
| Kit controls only, 32px tall | `bare-control` and `control-height` in `scripts/check-markup.mjs`, also after every edit |
| Every input has a visible label | axe in the e2e, light and dark |
| A field and its neighbour line up | `row-heights` in the runtime audit (`docs/audit.md`) |
| The page never scrolls; one region does | `page-scroll` and `nested-scroll`; Kestrel's new invoice is the type's sample in `e2e/screens.spec.ts` |

## What AI coding tools build instead

- **Save at the top, or a footer inside the scroll.** On a long form people scroll to find it. Here the footer stays on screen.
- **Submit in the top bar.** A form is the exception the Screen makes: its save stays ink, by the fields.
- **A paragraph under the title** that explains the form. The header has no slot; what happens next goes into the summary, as the starter's card does.
- **"Invalid value".** Messages say what to do.
- **Work lost on leaving.** The blocker asks first.
- **A form inside a form** for a related record, which HTML does not allow. The dialog sits outside, and the save button uses the `form` attribute.

## Screens of this type

- [Invoice form](https://meadowstack.com/screens/invoice-form/): Kestrel's new invoice, the type's sample, with the totals per VAT rate in the summary.
- [Quote form](https://meadowstack.com/screens/quote-form/): Foldline's quote with `summaryWidth="wide"`: the calculation follows every keystroke beside the brief.
- [Change order form](https://meadowstack.com/screens/change-order-form/): Stonebridge's change orders, with the new contract price in the summary.

What happens after a save, approval included: the [approval flow](https://meadowstack.com/patterns/approval-flow/) pattern.

## Example apps with a form screen

*Which example apps render a form screen, and the record flows each one uses.*

| Example app | Modules | Side panel first | Decision card | History |
| --- | --- | --- | --- | --- |
| [An app for a packaging and print company](https://meadowstack.com/examples/packaging-print-production/) | 5 | Yes | Yes | Yes |
| [An app for a construction company](https://meadowstack.com/examples/construction-site-management/) | 8 | Yes | Yes | Yes |
| [An app for an accounting office](https://meadowstack.com/examples/accounting-office-documents/) | 4 | Yes | Yes | Yes |
| [An app for restaurants and venues](https://meadowstack.com/examples/restaurant-staff-rota/) | 5 | Yes | Yes | Yes |

Read from the demo's source when the site was built: 4 of 9 example apps render a <Screen archetype="form">. Side panel first means RecordPeek, the decision card ApprovalPanel, the history AuditTimeline.

## How the starter fills the slots

*The starter's request form: a summary card that says what happens next, and a footer whose save button reaches the form element by its id.*

From `templates/starter/src/modules/requests/pages/request-form.tsx` in the Meadowstack repository:

```tsx
// The fields, the summary and the footer are slots of one screen; the footer's save button reaches the form by its id.
return (
  <Screen
    archetype="form"
    header={{ title }}
    summary={
      <Card>
        <CardHeader>
          <CardTitle>What happens next</CardTitle>
        </CardHeader>
        <CardContent className="pt-3">
          <ol className="flex list-decimal flex-col gap-2 pl-4 text-sm text-fg-muted marker:text-fg-muted">
            <li>It is saved as a draft that only you can see.</li>
            <li>You submit it for approval from the request.</li>
            <li>Someone else approves it, or rejects it with a reason you can fix.</li>
          </ol>
        </CardContent>
      </Card>
    }
    footer={
      <>
        <Button asChild variant="ghost">
          <Link to={cancelTo}>Cancel</Link>
        </Button>
        <Button type="submit" form={formId} variant="primary" loading={formState.isSubmitting}>
          {saveLabel}
        </Button>
      </>
    }
  >
    <form id={formId} onSubmit={onSubmit} noValidate className="flex min-w-0 flex-col gap-5">
```

## Questions

### Can a form have its primary action in the top bar?

No. Every other screen type moves its primary action into the top bar, where it draws quiet, but a form keeps its own, and its save is the ink button in a footer that stays on screen while the fields scroll.

### How wide should a form be?

640px for fields alone, 960px with a summary column beside them, and 1200px when the summary is a working result people read while they type, such as a price calculation. The type sets the width, so no form picks its own.

### Where does the summary go on a phone?

After the fields, in the same scroll. That is why Kestrel's invoice form repeats the total beside Save in the footer, where it stays in reach.

### What happens when someone leaves a form with unsaved changes?

The router's blocker asks first through the kit's confirm dialog, so a click in the sidebar does not throw the work away.

### Does a long form need a wizard?

Rarely. The type has a slot for steps, but no form in the demo uses it: each is one column of sections, with the summary showing the result as people type.

## Related

- [An invoice form that shows its totals as you type](https://meadowstack.com/screens/invoice-form/) (Screens)
- [A change order that shows its price before anyone approves it](https://meadowstack.com/screens/change-order-form/) (Screens)
- [A packaging quote that works out its price as you type](https://meadowstack.com/screens/quote-form/) (Screens)
- [DataTable: the table of every list](https://meadowstack.com/components/data-table/) (Components)
- [A restaurant rota planned against the takings](https://meadowstack.com/screens/staff-rota/) (Screens)
- [Closing the till at the end of a shift](https://meadowstack.com/screens/till-close/) (Screens)
