Skip to content

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

child
↕ gap
child
↕ gap
child
  • display — flex
  • width — auto
  • height — auto
  • intrinsicSize — flex container; sized by children
  • stackable — true
  • fullBleed — false

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.

space.1, space.2, space.3, space.4, space.5, space.6

Notes

  • Presentational. Use a semantic element via children.
Component Relation Note
Flex alternative Flex when you need explicit align/justify control.
Grid alternative Grid for 2-D layout.
Box sibling

These are the AI prompt → JSX mappings used by the helix-ui prompt DSL and integrations like Cursor / Claude Code.

“vertical stack with 16px gap”

<Stack gap={4}>{children}</Stack>

“horizontal stack with right alignment”

<Stack direction="row" justify="end" gap={2}>
{buttons}
</Stack>