When to use
Section titled “When to use”Use Grid to place children in equal-width columns: page regions, card grids, dashboard widgets. The number of columns can change with the viewport width.
When not to use
Section titled “When not to use”- For tabular data: Use a table for data with row and column headers. Grid does layout only and carries no table meaning.
- For one-direction flow: Use Stack for vertical and Inline for horizontal.
- For unequal column widths: Grid produces equal columns only; for different widths, span cells with
span. - For a box look: If you need padding, a surface or a border, wrap each cell in a Box.
Anatomy
Section titled “Anatomy”Grid has two parts:
- Grid: a
display: gridcontainer.columnsandgapapply to this element. - Cell:
Grid.Item(data-part="item").spansets how many columns it takes. Another element can also be a direct child; it takes one column.
Behaviour
Section titled “Behaviour”- Grid is static: it does not change on hover, click or focus, and it is not in the tab order.
- Defaults:
columns1,gaplg. - Breakpoints:
basebelow 1024 px,mdfrom 1024 px (Tailwindlg:),lgfrom 1440 px. A breakpoint without a value keeps the value of the smaller one. - Children fill left to right, row by row, in DOM order; there is no prop to reorder them.
Guidelines
Section titled “Guidelines”Start with one column on narrow screens
Section titled “Start with one column on narrow screens”Keep base small and add columns with md and lg; on a narrow screen the content stays readable.
First item
Second item
First item
Second item
Third item
Do not use a grid instead of a data table
Section titled “Do not use a grid instead of a data table”Use a table for data with row and column headers; Grid does not pass that relation to a screen reader.
Card title
Card title
Field labelSample textField labelSample text
Content
Section titled “Content”- Grid carries no text of its own.
- When you pass
render={<ul />}, give everyGrid.Itemrender={<li />}. - Keep example text neutral: “First item”, “Card title”.