Grid
Grid lines its children up in rows and columns at the same time.
Use a Grid when children must line up in two directions, such as a set of cards or a form with two columns. For a single row, use Flex. For a single column with even spacing, use Stack.
Grid is a Box with display: grid, so it accepts the Box props plus columns, rows, areas, flow, gap, gapX and gapY. It has no direction or wrap props, because a grid ignores them, and TypeScript reports an error if you set them.
columns, rows and areas accept CSS template values as strings, such as repeat(3, minmax(0, 1fr)). The gap props accept steps on the spacing scale, and the theme's density decides how large each step is. Place a child in a named area or across several columns with gridArea on a Box.
Most props accept either one value or a value for each breakpoint: { initial, sm, md, lg }. The breakpoints measure the nearest Box with container, or the whole app when there is none, so the same grid adapts to a narrow panel and to a wide page.
A Grid has no keyboard or screen-reader behaviour of its own. The order of the children in your code is the reading order and the tab order, so keep it the same as the order on screen when you move children with areas or gridArea.
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. |
display? | "grid" | "inline-grid" | Set inline-grid to place the grid in a line of text. |
render? | RenderElement | Renders the box as a different element, so you don't add a wrapper. |
It also takes every prop of a <div>.