Skip to main content

Layout widgets

Layout widgets answer one question before anything else in the user interface does: how should space be divided, constrained, layered, and protected?

That makes them different from display widgets, which mostly show information, and input widgets, which mostly collect intent. Layout widgets decide the structure the rest of the user interface lives inside.

How to choose among layout widgets

Start with the simplest structure that matches the reading order.

Use a vertical flow first when the screen reads top to bottom. Use a horizontal flow when side-by-side comparison matters. Move to grids when repeated content benefits from a matrix. Use stacks and positioned layouts when layering is the point, not just ordinary arrangement.

Once the overall structure is clear, add helpers for centering, safe areas, ratio preservation, wrapping, or split panes where those patterns are genuinely needed.

Core linear and constraint widgets

These are the first widgets to reach for on most screens.

WidgetDedicated pageWhen to choose it
ContainerContainerYou need one child plus padding, sizing, background, or constraint control
RowRowChildren should stay in a horizontal sequence
ColumnColumnChildren should stay in a vertical sequence
SpacerSpacerYou need fixed or flexible empty space
ScrollScrollContent may legitimately exceed the viewport
AlignAlignA child needs alignment inside available bounds
CenterCenterYou only need centered placement

Higher-level stack and flow helpers

These widgets express layout patterns that are already common enough to deserve named helpers.

WidgetDedicated pageWhen to choose it
HStackHStackYou want a higher-level horizontal stack helper
VStackVStackYou want a higher-level vertical stack helper
WrapWrapRepeated items should flow onto new lines as width changes
SimpleGridSimpleGridYou want a simpler grid authoring surface
SplitViewSplitViewThe screen is naturally a split-pane layout
SplitDirectionSplitDirectionYou need the supporting split orientation type

Grid and layered layouts

Use these when a purely linear layout is no longer the right shape.

WidgetDedicated pageWhen to choose it
GridGridRepeated content belongs in rows and columns
GridItemGridItemA child needs span or placement rules inside a grid
ZStackZStackChildren should share the same visual area in layers
PositionedPositionedA layered child needs explicit placement
OverlayOverlayContent and overlay content share the same region deliberately

Edge protection, ratios, and adaptive helpers

These widgets become important when a layout needs to react to host conditions or special constraints.

WidgetDedicated pageWhen to choose it
SafeAreaSafeAreaContent should avoid host insets such as mobile safe areas
AspectRatioAspectRatioA child should preserve a specific width-to-height ratio
LayoutBuilderLayoutBuilderThe build output depends directly on current constraints
absolute_fill(...)absolute_fillA child should fill the stacked bounds
ClipClipA child must be clipped to a region
TransformTransformA child needs visual transformation
CompositeCompositeYou need composition or repaint-boundary control
FocusScopeFocusScopeFocus traversal should stay within a layout region

Practical cross-reference

If the next question is really about themed or responsive screen composition, pair this page with the guide on Layout and widgets. If the next question is about a particular widget family rather than structure, return to the Widget catalog.