Grid
The 2-D sibling of Stack: a thin, token-bound CSS-grid primitive, not a grid framework. `<Grid>` sets the column track and gap on the foundation `--spacing` scale; `<GridItem>` spans columns, responsively. Two FLAT components rather than one with a `kind…
Preview
Rendered from the story the storybook (a11y) CI gate runs axe against — the preview can't show something that hasn't been verified.
Install
Two equivalent paths — the URL works in any shadcn-CLI setup; the alias works once you've registered @interlace in your components.json.
npx shadcn@latest add https://ds.interlace.tools/r/grid.jsonnpx shadcn@latest add @interlace/gridHistory
This component is at v2.0.2, first shipped in @interlace/ui 1.0.0. The version is stamped as a banner into the file the install writes, so the copy in your tree says which one you have — compare it with the number above before deciding whether to re-run the install.
@interlace/ui 2.0.03 entries
- Breakingmajor
Interlace no longer rewrites the host app's Tailwind theme. Installing one component used to redefine
max-w-sm(24rem became 1rem), movesm:from 640px to 480px, delete2xl:and change everyrounded-sm|md|lg. Spacing is now Tailwind's numeric scale, which follows--spacing. Radius derives from--radiusexactly as shadcn derives it. The only breakpoint Interlace declares is a newxs:tier at 480px, which Tailwind doesn't use. Components render pixel-for-pixel as before.Components- @interlace/accordion
- @interlace/alert
- @interlace/alert-dialog
- @interlace/article-card
- @interlace/article-list-grid
- @interlace/article-template
- @interlace/auth-template
- @interlace/author-byline
- @interlace/author-template
- @interlace/blog-home-template
- @interlace/box
- @interlace/breadcrumb
- @interlace/button
- @interlace/button-variants
- @interlace/callout
- @interlace/checkbox
- @interlace/code-block
- @interlace/code-editor
- @interlace/code-window
- @interlace/combobox
- @interlace/command-palette
- @interlace/container
- @interlace/context-menu
- @interlace/cta-section
- @interlace/dashboard-template
- @interlace/data-table
- @interlace/dialog
- @interlace/distribution
- @interlace/docs-page-template
- @interlace/dropdown-menu
- @interlace/empty-state
- @interlace/error-template
- @interlace/faq
- @interlace/feature-grid
- @interlace/figure
- @interlace/focus-cards
- @interlace/focus-ring
- @interlace/footer
- @interlace/grade-badge
- @interlace/hero
- @interlace/hero-cosmic
- @interlace/hover-card
- @interlace/input
- @interlace/landing-template
- @interlace/lint-playground
- @interlace/metric-table
- @interlace/network-graph
- @interlace/newsletter-form
- @interlace/number-field
- @interlace/page-header
- @interlace/pagination
- @interlace/popover
- @interlace/prev-next-post
- @interlace/pricing-table
- @interlace/prose
- @interlace/radial-weave
- @interlace/registry-item-template
- @interlace/related-posts
- @interlace/scorecard-row
- @interlace/scorecard-template
- @interlace/section-boundary
- @interlace/select
- @interlace/settings-template
- @interlace/sheet
- @interlace/shimmer-button
- @interlace/skeleton
- @interlace/skeleton-variants
- @interlace/skip-link
- @interlace/stack
- @interlace/stat-card
- @interlace/stat-group
- @interlace/stat-strip
- @interlace/stats-template
- @interlace/sunny-background
- @interlace/tabs
- @interlace/tag-template
- @interlace/testimonial
- @interlace/textarea
- @interlace/theme
- @interlace/theme-switcher
- @interlace/theme-tokens
- @interlace/time-series
- @interlace/timeline-map
- @interlace/toast
- @interlace/toc
- @interlace/toggle
- @interlace/tooltip
- @interlace/topbar
- Changedpatch
Grid's column gap never takes more than one track's share of the width (100% / cols). Gaps are in rem and grow with a reader's text size; at 150% on a 390px phone, eleven 36px gaps in a 12-column grid came to 396px in a 342px column and pushed every section sideways. The row gap and every step's value are unchanged, and on a phone at 100% the cap never bites. On wider screens it trimsxland2xlonly where eleven of their gaps would overflow. Agap-*className still replaces it. - Changedpatch
-
Grid: thelg,xland2xlgaps cap their column gap belowmd(rows keep the full gap), so a 12-column grid no longer scrolls sideways on a phone. -Callout: the surface is opaque (the tint is laid over a solid page-colour fill) and the callout sets its own text colour, so it reads the same on a brand band, an image or the page. -Citationmarker="chip": the pill is capped at 24 characters (or the line) and ends in an ellipsis; the whole text stays in its accessible name and the popover.Components
Import
4 named exports — pull the parts you need.
import { Grid, GridItem, gridItemVariants, gridVariants } from '@/components/ui/grid';Variants
Closed prop unions enforced by class-variance-authority. See Storybook's Variants story for the rendered matrix.
- cols
- 1
- 2
- 3
- 4
- 6
- 12
- gap
- none
- xs
- sm
- mddefault
- lg
- xl
- 2xl
API reference
Parsed from the type declarations in the source — the same file the install writes into your tree, so this table can't drift from the component you get.
GridProps
Plus the variant props listed above.
| Prop | Type | Description |
|---|---|---|
| as | React.ElementType | Render as a different element (e.g. `ul`, `section`). Default `div`. |
GridItemProps
Plus the variant props listed above.
| Prop | Type | Description |
|---|---|---|
| as | React.ElementType | Render as a different element (e.g. `li`, `article`). Default `div`. |
Accessibility
Every story for this component is rendered headlessly and checked with axe-core (wcag2aa, wcag22aa, best-practice, ACT) on every PR. That gate has no continue-on-error, so what ships has zero known violations.
What follows is what static analysis can see. Axe cannot press a key and never sees an overlay open, so the operable-without-a-mouse claim lives in Behavior instead, where the keyboard path is replayed step by step.
- Focus + keyboard behaviour
- Native element semantics — no interaction layer to get wrong.
- Focus ring (WCAG 2.2 SC 2.4.13)
- Not focusable — no focus indicator required.
- Reduced motion
- No animation to gate.
- ARIA in the source
- None — semantics come from the element or the Base UI primitive rather than hand-written ARIA.
Examples
2 more states from the same story file.
R-rule compliance
Every primitive in @interlace/ui models to the portable 26-rule floor enforced by the componentApi ESLint preset. The cells below pin exactly where each rule applies in this file.
| Rule | Concept | Where |
|---|---|---|
| R1 | New primitive, not a Stack mode | 2-D track + span are meaningless on a flex Stack |
| R4 | Extends native el + VariantProps | `React.ComponentProps<'div'> & VariantProps<...>` |
| R6 | data-slot on both parts | `data-slot="grid"` / `"grid-item"` |
| R7 | className merged + ...rest + ref | `cn(variants(...), className)` + `{...props}` |
| R11 | Two flat components, no kind-prop | `Grid` + `GridItem`, not a discriminated union |
| R18 | Tailwind only | zero inline style; static class maps (JIT-safe) |
| R19 | Tokens only | gap→gap-{--spacing}; cols/span→closed unions (R21) |
| R25 | Server component | no hooks → no 'use client' |
Dependencies
- Base UI primitive
- Native / no Base UI dependency
- Lucide icons
- none
- NPM dependencies
class-variance-authority
- Registry dependencies
Source
The full implementation — components/ui/grid.tsx once installed.
import * as React from "react";
// @interlace/grid v2.0.2 — Interlace design system.
// Docs, props and live preview: https://ds.interlace.tools/c/grid
// What changed since: https://ds.interlace.tools/c/grid#history
// Generated banner — keep it, the upgrade diff reads this version.
/**
* @interlace/ui — Grid / GridItem
*
* The 2-D sibling of Stack: a thin, token-bound CSS-grid primitive, not a grid
* framework. `<Grid>` sets the column track and gap on the foundation
* `--spacing` scale; `<GridItem>` spans columns, responsively. Two FLAT
* components rather than one with a `kind: "container" | "item"` union, and
* both are server components.
*
* | Rule | Concept | Where in this file |
* | ---- | -------------------------------- | --------------------------------------------------- |
* | R1 | New primitive, not a Stack mode | 2-D track + span are meaningless on a flex Stack |
* | R4 | Extends native el + VariantProps | `React.ComponentProps<'div'> & VariantProps<...>` |
…161 more lines…Registry JSON
The raw registry record — what the shadcn CLI fetches.