Stack
Vertical layout primitive — a flex column with token-driven gap, align, and justify. The right reach when children should flow top-to-bottom with consistent spacing.
Renders a single <div> (or polymorphic as). No list semantics; wrap in <ul>/<ol> when items belong to a logical list so SR users get an enumeration.
import { Box, Stack } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<Stack gap="3" padding="4" background="bg.subtle" borderRadius="md">
<Box padding="3" background="bg.surface" borderRadius="sm">
First
</Box>
<Box padding="3" background="bg.surface" borderRadius="sm">
Second
</Box>
<Box padding="3" background="bg.surface" borderRadius="sm">
Third
</Box>
</Stack>
);
}
gap accepts any space token (or a responsive map). Cynosure stack-rhythm is built from this single prop — no per-child margins, no :not(:last-child) adjustments. Children always sit at the requested distance.
Align and justify
Section titled “Align and justify”align controls cross-axis (horizontal) alignment, justify controls main-axis (vertical) distribution. Both accept the standard start | center | end | stretch set plus space-between / space-around / space-evenly for justify.
import { Box, Stack } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<Stack gap="2" align="center" padding="4" background="bg.subtle" borderRadius="md">
<Box padding="2" background="bg.surface" borderRadius="sm" width="40%">
Narrow row
</Box>
<Box padding="2" background="bg.surface" borderRadius="sm" width="70%">
Wider row
</Box>
<Box padding="2" background="bg.surface" borderRadius="sm" width="55%">
Centered horizontally
</Box>
</Stack>
);
}
Dividers between children
Section titled “Dividers between children”Pass any node to dividers and Stack inserts a copy between every pair of children — typically a <Divider /> but any thin element works.
import { Divider, Stack, Text } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<Stack gap="3" padding="4" background="bg.subtle" borderRadius="md" dividers={<Divider />}>
<Text weight="semibold">First section</Text>
<Text weight="semibold">Second section</Text>
<Text weight="semibold">Third section</Text>
</Stack>
);
}
Recipes
Section titled “Recipes”- Drop a
Stackinside aContainerfor the canonical “stacked content column” pattern — see most foundation pages on this site. - Set
align="stretch"(the default) to fill the cross-axis; switch toalign="center"for centered cards on a wide canvas. - For horizontal flow, reach for
InlineorFlex direction="row"— Stack is locked to column. - Pair
dividers={<Divider />}withgap="0"to render an undivided list where the rules carry all of the visual rhythm.