Skip to content
← Inventory

Grid

CSS Grid layout with configurable columns, gaps, and alignment; every visual prop accepts a responsive object keyed by breakpoint. Compose column spans with GridCol children.

Red
Amber
Green
Teal
Blue
Violet

Usage

import { Grid, GridCol, GridColProps, GridProps } from "@desk/ui/components/grid";

Best practices

  • Grid gives full 2-D control — compose GridCol children with span/start/order; if you only need equal-width responsive columns, SimpleGrid is lighter.

  • columns, gap, and alignment each accept a per-breakpoint object; responsiveMode="container" resolves them against the nearest container query.

Props

Grid

PropTypeDefaultDescription
alignResponsiveValue<FlexAlign>

Align items on the block axis. Can be responsive.

columnsResponsiveValue<number>

Total columns in the layout. Can be a number or responsive object. Defaults to 12.

gapResponsiveValue<"base" | "none" | "2xs" | "xs" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "3xs">

Gap between items. Can be responsive. Defaults to "base" (16px).

growboolean

When true, columns grow equally to fill available space.

justifyResponsiveValue<FlexJustify>

Justify items on the inline axis. Can be responsive.

responsiveModeResponsiveMode

Responsive mode: "screen" (viewport) or "container" (container queries).

xGapResponsiveValue<"base" | "none" | "2xs" | "xs" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "3xs">

Horizontal gap between items. Can be responsive. Overrides gap on inline axis.

yGapResponsiveValue<"base" | "none" | "2xs" | "xs" | "sm" | "lg" | "xl" | "2xl" | "3xl" | "3xs">

Vertical gap between items. Can be responsive. Overrides gap on block axis.

GridCol

PropTypeDefaultDescription
orderResponsiveValue<OrderValue>

CSS order value (1-12, "first", "last", "none"). Can be responsive.

responsiveModeResponsiveMode

Responsive mode: "screen" (viewport) or "container" (container queries).

spanResponsiveValue<number>

Number of columns this item spans. Can be responsive.

startResponsiveValue<number>

Column start position (1-based). Can be responsive.

Also exports

  • interfaceGridColProps
  • interfaceGridProps