# Stack

Supply UI 1.1.0. Layout.

Things under each other. The gap says how far apart they belong: `1`–`4` inside a group, `6` between groups, `8` between the parts of an app's screen, `12` between the sections of a public page (a landing page's rooms, reviews and questions). A landing page made with `8` reads as one crowded block

Things under each other, spaced by `gap` rather than by margins on the children

## Options

| Option | Type | Default | What it does |
| --- | --- | --- | --- |
| `gap` | `1 \| 2 \| 3 \| 4 \| 6 \| 8 \| 12` |  | The space between them: `1`–`4` inside a group, `6` between groups, `8` between the parts of a screen, `12` between the sections of a public page. |

It also takes the 280 attributes of the element or UI SDK part it renders (`className`, `aria-label`, events…).

## Without React

Classes: `ui-stack` + `ui-gap-4`

## In the examples

- The month in three numbers: A figure, its change, and the line that led there (https://www.supply.family/ui/#scene-numbers)
- Running low: Set a range and the shelf list narrows to it (https://www.supply.family/ui/#scene-stock)
- Loading, politely: Grey shapes hold the place until the classes arrive (https://www.supply.family/ui/#scene-loading)
- Join in three steps: A plan, a name, a tick. Next stays off until each step is done. (https://www.supply.family/ui/#scene-checkout)
- Set up, one step at a time: Open a step, mark it done, watch the bar (https://www.supply.family/ui/#scene-setup)
- Out of ten: A low score opens a question, a high one says thanks (https://www.supply.family/ui/#scene-score)
- An invoice that adds up: Change a quantity or a price; the lines and VAT follow (https://www.supply.family/ui/#scene-invoice-lines)
- A sidebar with sections: Pick a section; its numbers change beside it (https://www.supply.family/ui/#scene-studio-sidebar)
- A dock that floats: The chosen tool shows its name; the rest stay icons (https://www.supply.family/ui/#scene-dock)
- The top of a website: Links in a row, panels of links under them (https://www.supply.family/ui/#scene-site-header)
- Tabs under the thumb: On a phone the sections sit along the bottom (https://www.supply.family/ui/#scene-phone-tabs)
- Jump anywhere with ⌘K: Pages and actions in one search (https://www.supply.family/ui/#scene-jump)
- Drop the photos in: Each file shows how far it has come (https://www.supply.family/ui/#scene-portfolio)
- A free morning for Biscuit: Days with room are marked. The times follow the day. (https://www.supply.family/ui/#scene-vet)
- Keep the streak: Minutes a day, and the run so far (https://www.supply.family/ui/#scene-streak)
- Vote, then see: Results stay hidden until you have picked (https://www.supply.family/ui/#scene-poll)
- What people said: The average, how it splits, and a voice from it (https://www.supply.family/ui/#scene-reviews)

## Layout: notes

**States.** Layout follows the box it is in, not the window: `Split`, `Grid`, `AppShell` and the site parts stack when their box is narrow, at any width of the window.

**Do**
- Space with `gap` (`Stack`, `Row`, `Grid`), never with margins on children.
- Put the page's sections straight on the page, under their titles; a `Card` is one thing a person picks or acts on.
- Check every screen at 320, 375 and 768 px with the narrow check of rule 10.

**Don't**
- Don't give a box a fixed width, or a `min-height` together with an `aspect-ratio`.
- Don't nest a card in a card.
- Don't put two `<main>`s on a page: a screen shown inside another page takes `Main as="div"`.
