Row
Things next to each other, lined up on their middles; it wraps onto more lines where they do not fit
Preview
Use
import { Button, Chip, ItemText, Row, Stack } from '@/components/ui';
<Stack gap={6}>
<Row gap={2}>
<Chip>Haircut</Chip>
<Chip>Colour</Chip>
<Chip>Beard trim</Chip>
<Chip>Wash and dry</Chip>
</Row>
<Row between>
<ItemText title="Invoice 0412" note="Due 30 November" />
<Button size="sm">Send</Button>
</Row>
</Stack>Options
| Option | Type | What it does |
|---|---|---|
between | boolean | Spreads them to both ends of the line. |
center | boolean | Moves them all to the middle of the line, left to right (a row of buttons under a centred title). |
gap | 1 | 2 | 3 | 4 | 6 | 8 | 12 | The space between the things: 1–4 inside a group, 6 between groups, 8 between the parts of a screen, 12 between the sections of a public page. |
nowrap | boolean | Keeps them on one line instead of wrapping. |
stretch | boolean | Makes them as tall as the row: a sidebar beside its content. |
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-row, ui-row--between, ui-row--center, ui-row--nowrap, ui-row--stretch.
With the CSS in parts (/ui/css/), it needs these, besides the ones every page loads:
components/input-group.cssIn the examples
Small screens made with it and the rest of the kit. They work: click, type and choose in them.
- Flour
- 250 g
- Milk
- 300 ml
- Eggs
- 2
- Butter
- 30 g
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 next to each other; wraps. They are always lined up on their middles from top to bottom, so nothing is needed for that. between spreads them to both ends; center moves them all to the middle of the line, left to right (a row of buttons under a centred title), never for lining up; stretch makes them as tall as the row: a sidebar beside its content. A text field in a row with its button fills the room the button leaves.
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".