Stack
Flexbox stacking primitives. Stack is a thin flex container with typed direction, align, justify, and gap props — no more reaching for raw flex flex-col gap-* utilities. VStack and HStack are convenience wrappers that pin the direction (and sensible defaults) so the common cases read at a glance.
All three ship together and share one prop surface (StackProps). Anything not covered by the typed props — width, padding, background, flex-wrap — goes through className.
VStack
VStack stacks children in a column (flex-col). It defaults to align="stretch" and gap={2}, so children fill the cross axis and sit two spacing units apart unless you say otherwise.
HStack
HStack lays children out in a row (flex-row). It defaults to align="center" and gap={2} — matching the way you almost always want an icon-and-label or a button row to behave.
Stack with explicit direction
Reach for the base Stack when the direction is dynamic or you want it spelled out. direction is "vertical" (the default) or "horizontal"; VStack / HStack are just Stack with this prop locked in.
Gap
gap is a number mapped to a Tailwind gap-* class. The supported steps are 0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, and 24 — a value outside this set produces no gap class. (A string is accepted by the type but only resolves if it matches one of those keys.)
Align and justify
align sets cross-axis alignment (items-*): "start", "center", "end", or "stretch". On an HStack this controls vertical alignment of children of differing heights.
justify sets main-axis distribution (justify-*): "start", "center", "end", "between", "around", or "evenly".
Reference
Stack, VStack, and HStack all share StackProps, which also extends React.HTMLAttributes<HTMLDivElement> — so any standard div attribute (id, onClick, style, …) passes through.
Stack
The base container. Renders a div by default.
| Prop | Type | Default | Description |
|---|---|---|---|
direction | "vertical" | "horizontal" | "vertical" | Flex direction (flex-col / flex-row) |
align | "start" | "center" | "end" | "stretch" | — | Cross-axis alignment (items-*) |
justify | "start" | "center" | "end" | "between" | "around" | "evenly" | — | Main-axis distribution (justify-*) |
gap | number | string | — | Gap between items. Supported: 0–6, 8, 10, 12, 16, 20, 24 |
as | React.ElementType | "div" | Render as a different element |
className | string | — | Merged after the variant + gap classes |
ref | React.Ref<HTMLDivElement> | — | Forwarded to the rendered element |
VStack
Stack locked to a column. Accepts every StackProps field except direction.
| Prop | Type | Default | Description |
|---|---|---|---|
align | "start" | "center" | "end" | "stretch" | "stretch" | Cross-axis alignment |
gap | number | string | 2 | Gap between items (same scale as Stack) |
HStack
Stack locked to a row. Accepts every StackProps field except direction.
| Prop | Type | Default | Description |
|---|---|---|---|
align | "start" | "center" | "end" | "stretch" | "center" | Cross-axis alignment |
gap | number | string | 2 | Gap between items (same scale as Stack) |