# Layout & grid

> Foundations · Tetrifox Brand Book · https://design.tetrifox.com/foundations/layout

## Purpose

Every Tetrifox screen begins with the same constraints: close the frame, quantize the space, assemble from cells. Layout is not decoration around content — it is the system the interface grows from.

## Rules

### Must

- **Close every edge. Each line meets a neighbour or the frame; build divided layouts from `Section`, `Cell` and `GridRow`, not ad-hoc `grid gap-*` or flexbox.** The closed lattice is the modular-assembly thesis made structural. An open edge or a floating border never resolves. [The closed grid](https://design.tetrifox.com/foundations/layout#closed-grid) · `layout.closed-grid`
- **Keep borders structural: 1px hairlines in `--border` or `--border-subtle`.** Borders are the grid lines of the system, not decoration. Tokens: `--border`, `--border-subtle`. [The closed grid](https://design.tetrifox.com/foundations/layout#closed-grid) · `layout.hairlines`
- **Use only the nine lattice steps — Tailwind `1, 2, 3, 4, 6, 8, 12, 16, 24` (4 to 96px) — for padding, margin and gaps.** A 4px base and an 8px rhythm keep every measure on the same beat. [Spacing lattice](https://design.tetrifox.com/foundations/layout#spacing-lattice) · `layout.lattice-steps`
- **Align primary text, captions, labels, tables, controls, Header and Footer to the content rail `px-6 md:px-8 lg:px-12` (24 → 32 → 48px). The compact navigation Rail is the one exception.** One inset per breakpoint lines every region up on the same vertical. [Spacing lattice](https://design.tetrifox.com/foundations/layout#spacing-lattice) · `layout.content-rail`
- **Use `Cell padding="standard"` or `padding="section"` and do not add competing `p-*` or `px-*` classes to a padded Cell. `padding="none"` is for full-bleed visuals.** The modes carry the rail and the vertical rhythm: `standard` is `px-6 py-4 md:px-8 md:py-6 lg:px-12 lg:py-8`, `section` is `px-6 py-16 md:px-8 md:py-24 lg:px-12`. `cn` joins class strings without resolving Tailwind conflicts, so a second padding class silently competes. [Spacing lattice](https://design.tetrifox.com/foundations/layout#spacing-lattice) · `layout.cell-padding`
- **Let the viewport be the frame: no outer gutters and no centred `max-w-* mx-auto` column around the interface.** Outer gutters let borders float away from the frame. Sections are full-bleed bands whose borders close against the viewport. [Frame & containers](https://design.tetrifox.com/foundations/layout#frame-containers) · `layout.full-bleed`
- **Cap reading measures inside content (`max-w-md`, `max-w-xl`, `max-w-3xl`) for readability on wide screens.** Readability comes from the line length of the text, not from boxing the whole page. [Frame & containers](https://design.tetrifox.com/foundations/layout#frame-containers) · `layout.capped-measure`
- **Pin the Rail (`w-64`, `border-r`) to the left edge, span a sticky Header (`border-b`) and a Footer (`border-t`) full width, and let `<main>` fill the rest. No border above the header or below the footer.** The shell's internal borders, with each Section's `border-b`, close every cell against the viewport. [Frame & containers](https://design.tetrifox.com/foundations/layout#frame-containers) · `layout.shell`
- **Assemble from three primitives: `Section` (a full-bleed band with a bottom hairline), `Cell` (padding, no borders) and `GridRow` (one divider that stacks as `border-t` and becomes `border-l` in a row).** A small vocabulary recomposes across viewports without visual drift. [Cellular primitives](https://design.tetrifox.com/foundations/layout#cellular-primitives) · `layout.primitives`
- **Draw status markers as squares, never circles: hollow for gap, muted fill for draft, brand fill for shipped.** The mark echoes the cell and gap shape the whole brand is built on. [Cellular primitives](https://design.tetrifox.com/foundations/layout#cellular-primitives) · `layout.square-status`

### Must not

- **Add a second outer `border border-border` to a specimen inside an already-framed region. Continue the matrix with `gap-px bg-border`, or separate parts with only the `border-t` / `border-l` they need.** One region, one frame. `Section`, `GridRow`, the shell and section-level matrices own the structural borders; doubled hairlines break the lattice. Tokens: `--border`. [The closed grid](https://design.tetrifox.com/foundations/layout#closed-grid) · `layout.one-frame-owner`
- **Use the `.5` half-steps: `p-1.5` (6px), `gap-2.5` (10px), `py-3.5` (14px).** Half-steps break the rhythm and are not part of the system. [Spacing lattice](https://design.tetrifox.com/foundations/layout#spacing-lattice) · `layout.no-half-steps`

### Prefer

- **Reserve self-contained micro-frames for small teaching diagrams whose border is the lesson: Layout specimens, Logo clearspace and incorrect-use examples, compact Mino diagrams.** These are the documented exceptions to one-frame-owner; anything else continues the lattice. [The closed grid](https://design.tetrifox.com/foundations/layout#closed-grid) · `layout.micro-frames`
- **Use `gap-2` between stacked items, `gap-8` between groups, and `py-16 md:py-24` for section rhythm.** Three named rhythms cover almost every vertical decision. [Spacing lattice](https://design.tetrifox.com/foundations/layout#spacing-lattice) · `layout.rhythm`

## Tokens used

| Token | Dark (`:root`) | Light (`.light`) |
| --- | --- | --- |
| `--border` | `#1f2933` | `#cbd2d9` |
| `--border-subtle` | `#323f4b` | `#e4e7eb` |

## Do / Don't

- **Frame.** Do: Full-bleed bands; the paragraph inside carries `max-w-xl`. Don't: A `max-w-7xl mx-auto` container whose border floats in the gutter.
- **Spacing.** Do: `gap-2`, `px-6 md:px-8 lg:px-12`, `py-16 md:py-24`. Don't: `p-1.5`, `gap-2.5`, `py-3.5`.

## Related chapters

- [Colour](https://design.tetrifox.com/foundations/colour.md)
- [Components](https://design.tetrifox.com/expressions/components.md)
- [Minos & configurations](https://design.tetrifox.com/expressions/minos.md)
