Row
Slant / Primitives
A horizontal, wrapping row with a gap and alignment.
Demo
Usage
import { Avatar, Badge, Button, Row, Text } from '@tuttn/slant'
// Side by side, 8px apart, centred on the cross axis, wrapping when out of room.
<Row><Badge tone="success">Live</Badge><Text muted>Deployed 2 minutes ago</Text></Row>
// A header: the title at the start, the actions at the end.
<Row justify="between">
<Text as="h2" variant="title">Checkpoints</Text>
<Row gap={6}><Button size="sm" variant="ghost">Export</Button><Button size="sm" variant="primary">New</Button></Row>
</Row>
// One line that never wraps, its children lined up at the top.
<Row wrap={false} align="start" gap={12}>
<Avatar initials="AK" name="Ada K." />
<Text>A message that wraps inside its own box instead of under the avatar.</Text>
</Row>
// A bar of links.
<Row as="nav" aria-label="Task" gap={16}>
<a href="#files">Files</a><a href="#checks">Checks</a>
</Row>Props
| Prop | Type | Default | Description |
|---|---|---|---|
gap | number | 8 | Space between children, in pixels. |
align | 'start' | 'center' | 'end' | 'stretch' | 'center' | Cross-axis alignment of the children. |
justify | 'start' | 'center' | 'between' | 'end' | 'start' | How the children spread along the row. |
wrap | boolean | true | Wraps onto more lines when the row runs out of room; `false` keeps one line. |
as | 'div' | 'section' | 'form' | 'nav' | 'header' | 'footer' | 'ul' | 'li' | 'div' | The element to render. |
…rest | HTMLAttributes<HTMLElement> | — | className, style, id, aria-* and handlers go on the root element, and so does the ref. A gap in style wins over the gap prop. |
Accessibility
- Row adds no role. Use
as="nav"with anaria-labelfor a bar of links,as="header"oras="footer"for a page region, andas="ul"(withrole="list") when the children are a list. justifyandalignmove children but never reorder them, so the reading order and the Tab order follow the DOM. Underdir="rtl"the row mirrors: start is on the right.- Keep
wrapon for anything that has to fit a 320px screen or 400% zoom. A row that can't wrap pushes its content past the edge instead of reflowing.