ZStack
ZStack stacks children along the z-axis. Every child sits in the same grid cell and shares the same origin — source order is paint order, so the last child appears on top.
What it is
A <Box display="grid"> with a one-cell grid template. Every child is wrapped in a display: contents Box assigned to that single cell, so children overlap without claiming layout space
beyond the largest one. Sizing comes from the largest child unless you set an explicit width or
height on ZStack itself.
The model matches the rest of React: source order is z-order. The last child paints on top.
Install
ZStack is exported from usemotif. No separate install.
API
ZStack
stablefunction ZStack(props: ZStackProps): JSX.Element
Children to stack. Each one renders inside an internal cell-assigning wrapper.
Every prop Box accepts. `display` and `gridTemplateAreas` are managed by ZStack.
Examples
Avatar with a badge overlay:
Image with caption: