Stack
Stack places its children in a column, one under the other, with a gap between them.
Use a Stack for most vertical layouts, such as a form, a list of settings, the inside of a card or a group of paragraphs. When the children sit side by side, use a Flex, and when they sit in rows and columns, use a Grid. A Stack is a Box with a column layout already set, so it takes the same props.
Set the space between children with gap. The value is a step on the space scale rather than a length, and the theme and its density setting decide how much space each step is. Components never set their own outer margin, so the Stack controls all of the space between them.
Because a column has one direction, a Stack has no direction, wrap, gapX or gapY. If you need a row, use Flex. To draw a line between items, place a Separator where you want it.
Most props accept a responsive value, such as { initial: "3", md: "5" }. The breakpoints measure the nearest Box marked with container, or the whole app when there is none. Use render to make the Stack a different element, such as a section or a form, while the layout stays the same.
Props
Generated from the types. It lists what this component DECLARES: a prop that arrives from a shared type or from the platform is real and is not repeated here.
| Prop | Type | What it does |
|---|---|---|
backdrop? | boolean | Marks an area where the components sit over other content, such as a toolbar over a canvas or a panel over an image. |
container? | boolean | Make this Box measurable. |
render? | RenderElement | Renders the box as a different element, so you don't add a wrapper. |
It also takes every prop of a <div>.