Design
Layout rules
Eight rules, L1 to L8, that decide levels, boundaries, spacing and ownership.
Code comments, the layout audit and the agent skill cite these rules by number. Components and the audit enforce them; an application follows them by choosing the right component rather than by writing CSS.
Code comments, the layout audit and the agent skill cite the layout rules by number,
L1–L8. They replace the former LAYOUT.md. The components and the audit enforce
them; the detail lives in the
visual contract.
| Rule | What it decides | Detail in the visual contract |
|---|---|---|
| L1 | Three levels: canvas, working surface, overlay. A component knows its level from where it renders; an application passes no level prop. | Surface and border levels |
| L2 | One boundary between content and canvas. Inside a working surface or overlay, a nested Surface, DataTable, Disclosure or Metric renders flat. ContentCard and KanbanCard keep their boundary. A control's border is not a frame. | Surface and border levels |
| L3 | Separate groups with the lightest tool: space, a heading, a hairline between peer groups (Stack({ divided: true })), a tinted well only for reference material. A frame never separates groups. | Surface and border levels |
| L4 | Choose the container by what the thing is: Surface for a working region, Section for a group inside it, ContentCard, KanbanCard or Metric for one independent object. | Surface and border levels |
| L5 | Heading sizes are pinned by level through tokens; the application passes words. Page and PageHeader take no description. ListPage keeps an optional description for short operational guidance, not to fill space. | Typography |
| L6 | Spacing by level, deeper is tighter: --faifo-page-padding-x, --faifo-surface-inset, --faifo-surface-head-gap, --faifo-gap-section, --faifo-gap-form-row. Values live in src/foundations/tokens.css. | Spacing and controls |
| L7 | Pattern rules: a modal body is one white region; a table on the canvas is its own surface and flat inside one; a form with several groups divides them; labels sit above their controls at every width and in every container (owner, 26/11/2026). | Spacing and controls; Surface and border levels |
| L8 | Ownership: application CSS does not restyle an element the design system renders (data-ui, data-pattern) and does not use revert-layer. When a component renders wrongly, change the component. | CSS ownership |
PageHeaderProps and PageProps omit description, so the type check enforces L5
for those two. auditLayoutCss (faifo-design/contract) and
faifo-design-layout-audit report owned-hook (L8), hand-made-frame (L2) and
revert-layer (L8); see
verification for adopting
the audit area by area.
#Choosing a page pattern
| The screen is | Use |
|---|---|
| A full collection | ListPage |
| One durable record | RecordPage |
| A board, a schedule or a queue beside its item | WorkspacePage |
| A first look at one item of a spatial view | Peek |
| A record or picker over the current page | ModalSheet |
| A question before a hard-to-undo action | ConfirmDialog |
#Stacks and local scrolling
Only the page header belongs directly on canvas. Other record content, including notices, facts and forms, belongs inside a working Surface. Keep each block's title inside its own Surface; do not frame the entire page. Section groups are internal and do not create a working surface.
Peer sections on one surface use Stack({ divided: true }). The stack owns one
1px --faifo-panel-border hairline and its gap on both sides. Flattening a child
Disclosure or Surface removes that child's frame, preserving the parent's divider,
including in flat presentation. See catalogue specimen peer-section-dividers.
A Disclosure line may start with leading, a small image or icon of the item (a
Thumbnail of size small for a product variant), before its label and meta.
The slot keeps its own size on the line's centre; without it the summary's markup is
unchanged.
A table's scroll region (ft-scroll of FaifoTable, table-scroll of DataTable) is the
boundary of its width: it contains its inline size (contain: inline-size), so the table
scrolls inside the region and never widens a parent Stack, a wrapping client island or the
page. Stack keeps an auto column and its children their default minimum, so a Stack
inside a table cell still reports its text as min-content and two-line cells never
collapse and overlap. Do not give the Stack a minmax(0, 1fr) track or shrink its
children, clip it, or add width overrides in consumers. See catalogue specimen
stack-scroll-boundary.
DataTable raises visible row controls above a row-link overlay. It leaves hidden native controls in enhanced pickers in their own positioning context, so the form proxy cannot create an extra line box or displace the visible trigger.
In the mobile stacked presentation, a cell containing a text input, select, textarea or combobox uses a full-width row for its editable value. DataTable owns the label/value row and immediate child sizing; Field owns input typography and inside spacing. This also covers a Field composed inside Stack with a price hint, whose intrinsic flex width otherwise reduced a purchase price input to 24px. Read-only cells and desktop table geometry retain their existing layout.
AppTopbar's location strip lets the context shrink before its navigation, search
and account controls. Context copy should use Text's breakWord for long names.