Stack
Stack arranges children in a vertical or horizontal direction with consistent spacing. HStack and VStack shorthands are also available.
Basic Usage
Item 1
Item 2
Item 3
import { Stack } from "@paramanu/primitives-react"
export default function App() {return ( <Stack gap="4"> <div>Item 1</div> <div>Item 2</div> <div>Item 3</div> </Stack>)}<div class="pm-stack pm-stack--vertical pm-stack--gap-4"><div style="background: #e2e8f0; padding: 8px 16px;">Item 1</div><div style="background: #e2e8f0; padding: 8px 16px;">Item 2</div><div style="background: #e2e8f0; padding: 8px 16px;">Item 3</div></div>Horizontal
A
B
C
import { HStack } from "@paramanu/primitives-react"
export default function App() {return ( <HStack gap="4"> <div>A</div> <div>B</div> <div>C</div> </HStack>)}<div class="pm-stack pm-stack--horizontal pm-stack--gap-4"><div style="background: #e2e8f0; padding: 8px 16px;">A</div><div style="background: #e2e8f0; padding: 8px 16px;">B</div><div style="background: #e2e8f0; padding: 8px 16px;">C</div></div>Accessibility
Stack is a presentational layout component. Use semantic children as needed.
Best Practices
- Use Stack for simple vertical/horizontal layouts with consistent spacing.
- Use HStack/VStack shorthands when direction is fixed.
- Enable
separatorto add visual dividers between items.
React Props
| Prop | Type | Default | Description |
|---|---|---|---|
direction | "vertical" | "horizontal" | "vertical" | Stack direction |
gap | SpacingScale | — | Gap between children |
align | FlexAlign | — | Cross-axis alignment |
justify | FlexJustify | — | Main-axis alignment |
separator | boolean | false | Show dividers |
CSS Classes
| Class | Purpose |
|---|---|
pm-stack | Base |
pm-stack--vertical | Vertical |
pm-stack--horizontal | Horizontal |
pm-stack--gap-{scale} | Gap |
pm-stack--separator | Dividers |