Overview
Grid renders a low-chrome CSS grid container for explicit columns, intrinsic
auto-fill layouts, and optional child placement through Grid.Item.
Usage
Use minItemWidth for intrinsic responsive grids without adding media queries:
When to use
- Building form layouts, card grids, or dashboards that need two-dimensional placement.
- Creating intrinsic responsive grids by passing minItemWidth.
- Presenting homogeneous gallery tiles - use grid-list instead. Use Grid List instead
- Packing variable-height content into waterfall columns - use masonry instead. Use Masonry instead
Examples
Auto-fill cards
Grid can create intrinsic responsive columns from a minimum item width.
Explicit placement
A 12-column grid using Grid.Item for spans while plain children use auto-placement.
Feature grid
A product-features section recipe: Grid with minItemWidth lays out icon + title + description tiles under a section heading.
Logo cloud
A trusted-by strip recipe: Grid auto-fills brand wordmarks under a heading, muted onto the subtle text ramp. Swap the wordmark spans for your real logo images.
Narrow collapse
With narrowCollapseEnabled, Grid falls back to a single column and resets item placement once its own width is 48rem or less.
Props
| Name | Type | Default | Description |
|---|---|---|---|
columns | number | Positive integer number of equal-width columns or a full CSS grid-template-columns value.
Numeric values render as repeat(<columns>, 1fr). | |
gap | text | Uniform row and column gap. | |
rowGap | text | Row gap override. Wins over gap for rows. | |
columnGap | text | Column gap override. Wins over gap for columns. | |
narrowCollapseEnabled | boolean | false | Enables a single-column fallback when the Grid element's border-box width is 48rem or less and resets direct Grid.Item placement to auto flow. |
minItemWidth | text | Minimum item width for an intrinsic auto-fill grid. When present, this takes
precedence over columns. | |
as | NonVoidHTMLElementTagName | 'div' | Rendered HTML tag. |
children required | snippet | Grid contents. |