Stack
A small helper for row and column layout, built on top of flexbox. Stack is the easiest way to line up a group of parts with an even gap between them.
Import
tsx
import { Stack } from "@aizvi/ui";Basic example
tsx
<Stack gap="2">
<div>Item one</div>
<div>Item two</div>
<div>Item three</div>
</Stack>Live preview
By default, Stack lines up its children in a column.
Row direction
tsx
<Stack direction="row" gap="2">
<div>Item one</div>
<div>Item two</div>
<div>Item three</div>
</Stack>Live preview
Align and justify
tsx
<Stack direction="row" justify="between">
<div>Left</div>
<div>Right</div>
</Stack>Live preview
aligncontrols the cross axis, meaning up and down in a row, or left and right in a column.justifycontrols the main axis, meaning left and right in a row, or up and down in a column.
Wrapping
Set wrap to allow children to move onto a new line when there is not enough room.
tsx
<Stack direction="row" wrap>
<div>Item one</div>
<div>Item two</div>
<div>Item three</div>
</Stack>Props
Stack accepts every normal <div> attribute, plus these.
direction, one ofroworcolumn. The default iscolumn.gap, one of1,2,3,4,5,6,8,10,12, or16. Maps to the matching--ds-space-*token. The default is4.align, one ofstart,center,end, orstretch. The default isstretch.justify, one ofstart,center,end, orbetween. The default isstart.wrap, a boolean. Allows children to move onto a new line. The default isfalse.
Accessibility
- Stack is a plain layout box. It does not add or remove any meaning, so it never affects how a screen reader reads your page.