Stack
Stack — one-dimensional flow. The single most-repeated shape in any application: a run of things in a line, evenly spaced. It replaces the `flex flex-col gap-4` / `flex items-center gap-2` strings that otherwise get retyped in every file, and it is the reason `gap` stays on the shared `SpaceToken` scale (see `./spacing`) instead of drifting per page. ```tsx <Stack gap="lg"> <Card /> <Card /> </Stack> <Stack direction="row" align="center" justify="between" gap="sm"> <h2>Members</h2> <Button>Invite</Button> </Stack> ``` Deliberately NOT here: responsive per-breakpoint directions. A layout that changes axis at a breakpoint is a `Split`, which owns that idea and names the breakpoint explicitly. Note for consumers of both surfaces: `@marktiderman/genesis-ui-native` splits this shape into two components, `Stack` (column) and `Inline` (row). On web they are one component with a `direction` prop, which is the established web idiom. The `gap` / `align` / `justify` vocabulary is identical either way — deliberately, and enforced by a test that reads the native definitions directly — so a spec written once still reads the same on both. That means the web unions are the SHARED vocabulary, not everything web flexbox can do; see the note on `align` below.
packages/ui/src/components/layout/stack.tsx
@marktiderman/genesis-ui/layoutimport { Stack } from "@marktiderman/genesis-ui/layout";react-docgen-typescript.Stack
Stack — one-dimensional flow. The single most-repeated shape in any application: a run of things in a line, evenly spaced. It replaces the `flex flex-col gap-4` / `flex items-center gap-2` strings that otherwise get retyped in every file, and it is the reason `gap` stays on the shared `SpaceToken` scale (see `./spacing`) instead of drifting per page. ```tsx <Stack gap="lg"> <Card /> <Card /> </Stack> <Stack direction="row" align="center" justify="between" gap="sm"> <h2>Members</h2> <Button>Invite</Button> </Stack> ``` Deliberately NOT here: responsive per-breakpoint directions. A layout that changes axis at a breakpoint is a `Split`, which owns that idea and names the breakpoint explicitly. Note for consumers of both surfaces: `@marktiderman/genesis-ui-native` splits this shape into two components, `Stack` (column) and `Inline` (row). On web they are one component with a `direction` prop, which is the established web idiom. The `gap` / `align` / `justify` vocabulary is identical either way — deliberately, and enforced by a test that reads the native definitions directly — so a spec written once still reads the same on both. That means the web unions are the SHARED vocabulary, not everything web flexbox can do; see the note on `align` below.
| Prop | Type | Default | Description |
|---|---|---|---|
| align | "start" | "center" | "end" | "stretch" | null | — | |
| direction | "row" | "column" | null | — | |
| gap | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | null | — | |
| justify | "start" | "center" | "end" | "between" | "around" | null | — | |
| testID | string | — | Stable test/automation selector (emitted as `data-testid`). |
| wrap | boolean | null | — |