Stack
Things under each other, spaced by gap rather than by margins on the children
Preview
Use
import { ItemText, Stack } from '@/components/ui';
<Stack gap={6}>
<Stack gap={2}>
<span className="ui-overline">Morning</span>
<ItemText title="09:30 Noor Haddad" note="Cut and finish · 45 min" />
<ItemText title="11:00 Otis Brandt" note="Colour · 2 hours" />
</Stack>
<Stack gap={2}>
<span className="ui-overline">Afternoon</span>
<ItemText title="14:15 Yuki Tanabe" note="Beard trim · 20 min" />
</Stack>
</Stack>Options
| Option | Type | 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 draws: className, aria-label, events and the rest.
Without React
The same look on any HTML, with the classes ui-stack + ui-gap-4.
In the examples
Small screens made with it and the rest of the kit. They work: click, type and choose in them.
Classes this week
- Wheel throwingTue 18:002 spots
- GlazingThu 18:305 spots
- Hand buildingSat 10:00Full
- Plan
- You
- Confirm
- Done
Layout: states, do and don’t
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.
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
Cardis 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-heighttogether with anaspect-ratio. - Don't nest a card in a card.
- Don't put two
<main>s on a page: a screen shown inside another page takesMain as="div".