Stacked content
import { Heading, Badge, Text } from "@senvenli/react/display";
import { Stack } from "@senvenli/react/layout";
export default function Example() {
return (
<Stack space="space-150" align="start">
<Badge tone="success">Paid</Badge>
<Heading level={3} size="heading-small">Invoice INV-2041</Heading>
<Text tone="subtle">Sent to Ada Lovelace on March 18, 2026.</Text>
</Stack>
);
}import { Stack } from "@senvenli/react/layout";Examples
Aligned
`align` places the children on the inline axis.import { Button } from "@senvenli/react/action";
import { Heading, Text } from "@senvenli/react/display";
import { Stack } from "@senvenli/react/layout";
export default function Example() {
return (
<Stack space="space-200" align="center">
<Stack space="space-050" align="center">
<Heading level={3} size="heading-small">Invite your team</Heading>
<Text tone="subtle">Projects are easier with everyone in one place.</Text>
</Stack>
<Button variant="primary">Invite people</Button>
</Stack>
);
}As a list
`as` keeps the list semantics while the stack sets the rhythm.import { Text } from "@senvenli/react/display";
import { Box, Stack } from "@senvenli/react/layout";
const STEPS = ["Order placed", "Payment received", "Order shipped"];
export default function Example() {
return (
<Stack as="ol" space="space-100">
{STEPS.map((step) => (
<Box key={step} as="li" padding="space-150" background="surface-sunken" radius="medium">
<Text>{step}</Text>
</Box>
))}
</Stack>
);
}Horizontal: A row of actions
Short items side by side with one gap.import { Button } from "@senvenli/react/action";
import { Stack } from "@senvenli/react/layout";
export default function Example() {
return (
<Stack direction="horizontal" space="space-100">
<Button variant="primary">Save changes</Button>
<Button>Preview</Button>
<Button variant="subtle">Cancel</Button>
</Stack>
);
}Horizontal: Space between
A title at the start and its actions at the end.import { Button } from "@senvenli/react/action";
import { Heading } from "@senvenli/react/display";
import { Stack } from "@senvenli/react/layout";
export default function Example() {
return (
<Stack direction="horizontal" space="space-200" justify="between">
<Heading level={3} size="heading-small">Customers</Heading>
<Stack direction="horizontal" space="space-100">
<Button iconBefore="download">Export</Button>
<Button variant="primary" iconBefore="plus">Add customer</Button>
</Stack>
</Stack>
);
}Horizontal: Wrapping
Items move to a new line when the row runs out of room.import { Badge } from "@senvenli/react/display";
import { Stack } from "@senvenli/react/layout";
const STATUSES = [
{ label: "Draft", tone: "neutral" },
{ label: "In progress", tone: "information" },
{ label: "Under review", tone: "warning" },
{ label: "Completed", tone: "success" },
{ label: "Canceled", tone: "danger" },
] as const;
export default function Example() {
return (
<Stack direction="horizontal" space="space-100">
{STATUSES.map((status) => (
<Badge key={status.label} tone={status.tone}>{status.label}</Badge>
))}
</Stack>
);
}Guidelines
When to use it
- Laying out content top to bottom with even spacing.
- Placing buttons, tags or short items in a row.
Use something else when
Do and avoid
- Space with
space(gap), never margins on the children.
Accessibility
Built in
- Layout only; no role.
- Follows the reading direction, so it flips in right-to-left languages.
API reference
Stack
| Prop | Type | Default | Description |
|---|---|---|---|
padding | Space | – | |
paddingInline | Space | – | |
paddingBlock | Space | – | |
background | Background | – | |
radius | Radius | – | |
shadow | Shadow | – | |
border | Border | – | |
as | LayoutElement | – | |
direction | "vertical" | "horizontal" | – |
|
space | Space | – | Gap between children ( |
align | "start" | "end" | "center" | "stretch" | Align | – | Cross-axis alignment (inline axis). |
justify | Justify | – | Distribution along the inline axis; |
wrap | boolean | – | Wrap onto new lines when space runs out. Default |
paddingSpacepaddingInlineSpacepaddingBlockSpacebackgroundBackgroundradiusRadiusshadowShadowborderBorderasLayoutElementdirection"vertical" | "horizontal"vertical(default): children stacked on the block axis.spaceSpaceGap between children (
gap, never margins).align"start" | "end" | "center" | "stretch" | AlignCross-axis alignment (inline axis).
justifyJustifyDistribution along the inline axis;
startis the reading start, so RTL flips with it.wrapbooleanWrap onto new lines when space runs out. Default
true.