Components / Layout

Layout

The spatial primitives. Box is the atom — every other layout component is a <Box> wearing a different name. Reach for the named primitive when it reads more clearly at the call site.

Updated 3 days agoEdit on GitHubWeb & native

The pieces

ComponentUse it for
BoxThe styling atom. Any styled, theme-aware container.
StackA flex container with consistent gap. Column by default.
HStackStack, horizontal. The most common stack shape.
VStackStack, vertical. Reads more clearly than Stack with no direction.
ContainerEstablishes a container-query context for @bp responsive keys.
CenterFlex container that centres on both axes.
FlexBare display: flex without Stack's gap conventions.
GridCSS Grid container with a uniform-column shorthand.
WrapFlex container with flex-wrap: wrap — tag lists, chip rows.
ZStackStack along the z-axis. Children share one grid cell.
AspectRatioWrap a child in a fixed width-to-height ratio.
SpacerEats the available main-axis space inside a flex container.
SafeAreaNo-op on web; wraps SafeAreaView on native.

Why so many

Most of these are sugar over Box. A Center is <Box display="flex" alignItems="center" justifyContent="center">. A Stack is <Box display="flex" gap=…> with a direction prop. The sugar exists because call sites read more clearly with names — and because compiled output costs the same either way.

Box is always available when the named primitive does not fit. Skip the named primitive if you need an unusual layout; the sugar is convention, not constraint.