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.A single component or array of components to arrange vertically.
Configuration options for the stack layout.
HStack
Arranges children in a horizontal line from leading to trailing.A single component or array of components to arrange horizontally.
Configuration options for the stack layout.
ZStack
Layers children on top of each other in a back-to-front stack. The last child in the array renders on top.A single component or array of components to layer. The last child renders on top.
Configuration options for the stack.
LazyVStack
A vertical stack that renders only the children currently visible on screen. Use inside a ScrollView for efficient rendering of long lists.A single component or array of components to arrange vertically with lazy rendering.
Configuration options for the lazy stack.
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.A single component or array of components to arrange horizontally with lazy rendering.
Configuration options for the lazy stack.
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 aGroup propagate to each child. A subviews overload lets you decompose an existing component tree and rearrange its children.
A single component or array of components to group together.
Subviews overload: a component whose children are decomposed into an array of subviews.
Subviews overload: a function that receives the subviews array and returns a new component layout.
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.
The content of the section.
Configuration options for the section.
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
ZStackand corner-aligned overlays