Stack
Category: Layout & primitives
Stack is a vertical flex container by default. Pass direction="row" for horizontal stacks.
<Stack gap={3}> <Item /> <Item /></Stack>
<Stack direction="row" gap={2} align="center"> <Avatar /> <Text>Name</Text></Stack>Install: @helix-ui/core
import { Stack } from '@helix-ui/core';status: stable · since: 0.1.0
Tags: primitive, flex, gap, rhythm
Anatomy
Section titled “Anatomy”child ↕ gapchild ↕ gapchildLayout
Section titled “Layout”- display —
flex - width —
auto - height —
auto - intrinsicSize —
flex container; sized by children - stackable —
true - fullBleed —
false
Visual
Section titled “Visual”An opinionated flex container. Default direction is column; pass direction="row" for horizontal. Token-aware gap controls spacing between children.
| Name | Type | Default | Description |
|---|---|---|---|
direction |
'row' | 'column' |
column |
Stack direction. One prop instead of separate HStack/VStack components. |
align |
'start' | 'center' | 'end' | 'stretch' | 'baseline' |
stretch |
Cross-axis alignment. |
justify |
'start' | 'center' | 'end' | 'between' | 'around' | 'evenly' |
start |
Main-axis alignment. |
gap |
number | string |
4 |
Gap between children. Numeric → space.N token. |
wrap |
boolean |
false |
Allow wrapping. |
Tokens used
Section titled “Tokens used”space.1, space.2, space.3, space.4, space.5, space.6
Accessibility
Section titled “Accessibility”Notes
- Presentational. Use a semantic element via children.
Composes with
Section titled “Composes with”| Component | Relation | Note |
|---|---|---|
Flex |
alternative |
Flex when you need explicit align/justify control. |
Grid |
alternative |
Grid for 2-D layout. |
Box |
sibling |
Prompt examples
Section titled “Prompt examples”These are the AI prompt → JSX mappings used by the helix-ui prompt DSL and integrations like Cursor / Claude Code.
vertical layout
Section titled “vertical layout”“vertical stack with 16px gap”
<Stack gap={4}>{children}</Stack>right-aligned button row
Section titled “right-aligned button row”“horizontal stack with right alignment”
<Stack direction="row" justify="end" gap={2}> {buttons}</Stack>