Grid

The Grid component creates a responsive auto-fit grid whose columns adapt to the available width.

Usage & Examples

Responsive Content Grid

AnalyticsWeekly performance
CustomersRecent activity
OrdersOpen fulfilment
responsive-content-grid.tsx
const tileStyle = {
  boxSizing: "border-box",
  display: "flex",
  flexDirection: "column",
  justifyContent: "center",
  width: "100%",
  height: "100%",
  minHeight: "4.5rem",
  padding: "1rem",
  border: "1px solid var(--border-color)",
  borderRadius: "var(--border-radius-md, 0.75rem)",
  background: "var(--background-color-surface)",
};

<Grid minColumnWidth="9rem" gap="md">
  <div style={tileStyle}><strong>Analytics</strong><span>Weekly performance</span></div>
  <div style={tileStyle}><strong>Customers</strong><span>Recent activity</span></div>
  <div style={tileStyle}><strong>Orders</strong><span>Open fulfilment</span></div>
</Grid>

Props API

9 props
Columns
Grid props API
Default
Description
alignLayoutAlignNopropsAlign prop for LayoutPrimitive.
asElementTypeNopropsAs prop for LayoutPrimitive.
childrenReactNodeNopropsContent rendered inside the component.
classNamestringNostylingAdditional CSS class names for the component root.
data-testidstringNotestingTest id used to identify the component in tests.
gapLayoutGapNoprops"md"Gap.
justifyLayoutJustifyNopropsJustify prop for LayoutPrimitive.
minColumnWidthstringNoprops"16rem"Min Column Width.
testIdstringNopropsTest id used to identify the component in tests.