Skip to content
TrademarkTrademark
Docs
Components

Grid

Updated: October 10, 2026
View on GitHub

Grid is the two-dimensional counterpart to Flex. Reach for it when children should line up in both directions — a card gallery, a pricing table, a stat row — rather than flow along one.

Everything that is not flex-specific works exactly as it does on Flex: the same spacing, size, surface, display and text props, and the same breakpoint objects. Only the two below are its own.

Columns

Three across, two on a tablet, one on a phone. The breakpoint objects cascade down, so m also covers s and xs unless one of them says otherwise.

A responsive Grid is a server component, the same as a responsive Flex: every breakpoint value that has a utility class — a column count, a spacing token, hide, position, overflow, opacity, zIndex — is written as one, so the layout is right in the first paint and no LayoutProvider is needed. Only a value a class cannot hold (a width, a number of rems for spacing, aspectRatio or style) moves the grid to the client, exactly where Flex moves too.

Auto-fit

When the column count should follow the space rather than the breakpoint, give a minimum width instead: minColumnWidth fits as many columns as there is room for, each at least that wide, and the grid reflows on its own as the container changes — inside a sidebar, a dialog or a full page alike.

It takes what minWidth takes: a number is rem, a string is a spacing token or a CSS unit. The grid stays a server component — the value is a .columns-auto-fit class plus a --grid-min-column-width custom property on the same element, not a style object. A narrow container never overflows: a single column shrinks below the minimum rather than spilling out.

minColumnWidth wins over columns, and a breakpoint columns still wins over it at that width, so minColumnWidth={16} s={{ columns: 1 }} is auto-fit everywhere except on a phone.

Type
Default
columns
How many equal columns. Set it per breakpoint to reflow.
123456789101112
—
minColumnWidth
As many columns as fit, each at least this wide. A number is rem; a token or CSS unit also works. Wins over columns.
numberSpacingTokenCSSUnit
—
rows
How many equal rows. Usually left alone — rows follow from the content.
123456789101112
—

Responsive

Type
Default
xl
Overrides applied at the xl breakpoint and below.
GridBreakpointProps—
l
Overrides applied at the l breakpoint and below.
GridBreakpointProps—
m
Overrides applied at the m breakpoint and below.
GridBreakpointProps—
s
Overrides applied at the s breakpoint and below.
GridBreakpointProps—
xs
Overrides applied at the xs breakpoint.
GridBreakpointProps—
position
CSSProperties["position"]relative
scrollbar
defaultminimal
minimal
…and every FlexProps propinherited—

Everything else

Grid takes the same shared props as Flex. They are documented once, on the Flex page:

  • Flex — one-dimensional layout, and the shared prop reference
  • MasonryGrid — for items of uneven height
  • Structure — how a page is composed from these
Edit this page on GitHub