Skip to main content

Common Examples

Creating CSS Grid layouts

The Grid component renders a div with display: grid. Set inline to render display: inline-grid instead. Track sizing, placement, alignment, and spacing are props. Each prop is written as an inline style and maps to a CSS property.Grid.Item renders the cell: a div that accepts placement props such as gridColumn, gridRow, and alignSelf. Any child can sit in the grid. Use Grid.Item when the cell needs those props and is not already a component that accepts layout utilities. The playground puts gridColumn and gridRow on Card because Card accepts those props directly.A Grid is always a grid container. Nested inside another Grid, it is also a grid item, and the placement props apply to that outer grid. Nested inside Flex, it is a flex item, and the flex item props apply.Layout props are merged after style, so they override the same CSS property set on style. className is combined with the component class.

Responsive props

sm, md, lg, xl, and xxl override props from that viewport width up. Widths come from the Hammer breakpoints:Base props apply at every width, including below 640px. There is no xs prop. Each property resolves on its own: the largest matching breakpoint that sets it wins, and otherwise the base value is used.A breakpoint object accepts the container, placement, and flex props. It does not accept inline. Nested sm, md, lg, xl, or xxl keys inside a breakpoint object are ignored.The example below is one column by default and two columns from md up.

Best Practices

  • Use Layout for the column structure of a page.
  • Use Grid for CSS Grid regions inside that content.
  • Use Grid.Item for a cell that needs placement props. Pass those props to Card (or another layout-aware component) when that component is the cell.
  • The playground uses Card only to visualize areas. See Card usage guidelines.

React Accessibility

Grid and Grid.Item render div elements. They do not set a role, and they do not handle keyboard interaction. Put focusable controls in the cell content. A generic div does not receive an accessible name from aria-label or aria-labelledby alone. To name the region, set a role that supports an accessible name, such as role="region", together with aria-label or aria-labelledby.gridColumn, gridRow, and order change visual position only. Assistive technology follows DOM order. Keep the source order in the reading sequence you want announced.
Last modified on October 5, 2026