Row
Things side by side, centred on one line. When there is no room they wrap onto the next line instead of overflowing.
import { Row } from '@sypnia/ui/react'
The head of a list
justify="between" pushes the two groups apart; each group is a Row of its own.
Code
import { Badge, Button, Row, SearchInput } from '@sypnia/ui/react';
export default function Header() {
return (
<Row justify="between" gap={3}>
<Row gap={2}><strong>Tables</strong><Badge>12</Badge></Row>
<Row gap={2}>
<SearchInput aria-label="Find a table" placeholder="Find a table" />
<Button variant="primary" icon="plus">New table</Button>
</Row>
</Row>
);
} Two by two on phones
pairs: on phones a bar of options becomes a grid of two columns, so nothing scrolls sideways. Make the window narrow to see it.
Code
import { Button, Row } from '@sypnia/ui/react';
// On phones the four buttons sit two by two: nothing scrolls sideways.
export default function Pairs() {
return (
<Row pairs gap={2}>
<Button>Today</Button>
<Button>This week</Button>
<Button>This month</Button>
<Button>All time</Button>
</Row>
);
} One takes the room left
fill: the first item grows into the room the others leave. When the row is narrower than 18rem for it, the others go to the next line.
Code
import { Button, Input, Row } from '@sypnia/ui/react';
// The field takes the room the button leaves. On a narrow screen the button goes to the next line.
export default function Fill() {
return (
<Row fill gap={2}>
<Input aria-label="Name of your business" defaultValue="laespiga" />
<Button variant="primary" icon="search">Search</Button>
</Row>
);
} When to use it
Use it when
- A title and its badge, a group of buttons, a field and its button.
- A bar of options that must sit two by two on phones (
pairs). - One thing that takes the room the others leave: a field beside its button, a map beside a phone (
fill).
Do not use it when
- The items are controls of one tool, used with the keyboard: that is a Toolbar.
- Many equal items, like cards: that is a Grid.
For everyone
- Wrapping keeps every item visible and in reading order: nothing is hidden behind a horizontal scroll.
Props
| Row | Type | Default |
|---|---|---|
as | ElementType | div |
className | string | |
fillThe first item takes the room the others leave: a map beside a phone, a field beside its button. When the row is too narrow for it (under 18rem) the others go to the next line. | boolean | |
gap | Gap | |
id | string | |
justifyWhere the items go along the row. | "start" | "end" | "between" | start |
nowrapKeep everything on one line. | boolean | |
pairsOn phones, lay the items out two by two (bars of options). | boolean | |
style | CSSProperties | |
topAlign to the top instead of the middle (for items of different heights). | boolean |