Skip to main content
Stacks are the primary layout primitives in BindJS. VStack, HStack, and ZStack arrange children vertically, horizontally, or as overlaid layers. LazyVStack and LazyHStack are virtualized variants for long scrollable lists. Group and Section add no layout of their own — they let you apply modifiers across multiple components or attach a header and footer for use inside List. Every stack accepts either (children) or (props, children). Alignment types differ by axis: VStack and LazyVStack use HorizontalAlignment, HStack and LazyHStack use VerticalAlignment, and ZStack uses Alignment.

VStack

Arranges children in a vertical line from top to bottom.
children
Component | Component[]
required
A single component or array of components to arrange vertically.
props
object
Configuration options for the stack layout.
Basic vertical stack
With spacing and alignment
Nested layout
Pushing content with spacers

HStack

Arranges children in a horizontal line from leading to trailing.
children
Component | Component[]
required
A single component or array of components to arrange horizontally.
props
object
Configuration options for the stack layout.
Basic horizontal stack
Avatar row with vertical alignment
Pushing edges apart
Baseline alignment

ZStack

Layers children on top of each other in a back-to-front stack. The last child in the array renders on top.
children
Component | Component[]
required
A single component or array of components to layer. The last child renders on top.
props
object
Configuration options for the stack.
Basic overlay
Caption with corner alignment
Notification badge
Layered backgrounds

LazyVStack

A vertical stack that renders only the children currently visible on screen. Use inside a ScrollView for efficient rendering of long lists.
children
Component | Component[]
required
A single component or array of components to arrange vertically with lazy rendering.
props
object
Configuration options for the lazy stack.
Basic lazy list
Pinned section headers
Leading-aligned message list
LazyVStack only creates views for children currently in the viewport. Always place it inside a ScrollView — without a scrollable parent there is no viewport boundary to drive the lazy rendering. For static lists, use VStack.

LazyHStack

A horizontal stack that renders only the children currently visible on screen. Use inside a horizontal ScrollView.
children
Component | Component[]
required
A single component or array of components to arrange horizontally with lazy rendering.
props
object
Configuration options for the lazy stack.
Horizontal carousel
Top-aligned cards
LazyHStack only creates views for children currently in the viewport. Always place it inside a horizontal ScrollView. For static rows, use HStack.

Group

Groups multiple components without adding any layout. Modifiers applied to a Group propagate to each child. A subviews overload lets you decompose an existing component tree and rearrange its children.
children
Component | Component[]
required
A single component or array of components to group together.
subviews
Component
required
Subviews overload: a component whose children are decomposed into an array of subviews.
transform
(subviews: Component[]) => Component
required
Subviews overload: a function that receives the subviews array and returns a new component layout.
Basic grouping
Apply a modifier to multiple children
Conditional rendering
Subview decomposition
Group adds no layout semantics. Children render according to the parent container’s layout rules. The subviews overload enables view decomposition — inspecting and rearranging children of an existing component tree.

Section

Groups content with an optional header and footer. Used inside List, Form, or LazyVStack with pinnedViews.
children
Component | Component[]
required
The content of the section.
props
object
Configuration options for the section.
Basic section
Section with header
Header and footer
Section inside a List
Sticky headers in a LazyVStack

See also

  • ScrollView — scrollable container for lazy stacks
  • List — scrollable list with native row chrome
  • ForEach — iterate over data to produce children
  • Spacer — flexible space inside stacks
  • Alignment — alignment values for ZStack and corner-aligned overlays