# GridBlock

> Responsive grid of case-study content cells with column, gap, spacing and background knobs, used across Work project pages.

- Status: stable
- Group: layout
- Page: https://www.digitaltableteur.com/design-system/components/grid-block
- Contract: https://www.digitaltableteur.com/contracts/v1/GridBlock.contract.json

## When to use

GridBlock lays out case-study content cells in a responsive grid with columns, gap, spacing and background knobs. Work project pages use it for image/text mosaics between StoryBlock narrative sections. Cells are free-form nodes; for the bare layout primitive use Grid, since GridBlock adds section chrome (max-width, background, spacing) around it. The root is the `as` element (default <section>) and carries the background through a CSS Modules class; the inner PageLayout wrapper is always a <div>, so sections never nest. className lands on the inner grid div. Defaults: columns 2, gap medium, backgroundColor transparent, maxWidth md, spacing comfortable. An image cell without src is dropped. A missing alt still renders alt="" (decorative) but logs a development warning, so pass alt for every informative image and alt="" only on purpose.

## When not to use

The contract records no forbidden uses.

## Look-alikes

The contract names no look-alike with a deciding condition.

## Props

| Prop | Type | Default | Description | Required |
| --- | --- | --- | --- | --- |
| `cells` | `GridCell[]` | none | Array of grid cells to render. | Yes |
| `columns` | `1 \| 2 \| 3 \| 4` | `2` | Number of columns in the grid. Defaults to 2. | No |
| `gap` | `"none" \| "small" \| "medium" \| "large"` | `medium` | Gap between cells. Defaults to "medium". | No |
| `backgroundColor` | `"transparent" \| "light" \| "white"` | `transparent` | Background color variant, applied to the outer element through a CSS Modules class. Defaults to "transparent". | No |
| `maxWidth` | `"sm" \| "md" \| "lg" \| "full" \| "xl"` | `md` | Maximum width constraint passed to the inner PageLayout. Defaults to "md". | No |
| `spacing` | `"compact" \| "default" \| "comfortable" \| "spacious"` | `comfortable` | Spacing variant passed to the inner PageLayout. Defaults to "comfortable". | No |
| `className` | `string` | `""` | Additional CSS class on the inner grid <div>, not on the root <section>. | No |
| `as` | `"article" \| "div" \| "section"` | `section` | Outer element. The inner PageLayout wrapper is always a <div>, so sections never nest. Defaults to "section". | No |

## Variants

- Allowed `columns` values: `1`, `2`, `3`, `4` (default `2`).
- Available gaps: `none`, `small`, `medium`, `large` (default `medium`).
- Allowed `backgroundColor` values: `transparent`, `light`, `white` (default `transparent`).
- Allowed `maxWidth` values: `sm`, `md`, `lg`, `full`, `xl` (default `md`).
- Available spacings: `compact`, `default`, `comfortable`, `spacious` (default `comfortable`).
- Allowed `as` values: `article`, `div`, `section` (default `section`).

## Invalid combinations

The contract records no invalid combinations.

## Keyboard

The contract records no keyboard interaction.

## Rules

Every item under When not to use is a MUST NOT. MUST and SHOULD follow RFC 2119.

| Level | Rule | How it is checked |
| --- | --- | --- |
| MUST | Required stories produce no axe violations at the configured severity. | Automated by `npm run test:stories:matrix:ci`. WCAG 2.5.8. |
| MUST | The accessibility tree (role, name, state) matches the committed snapshot for every required story. | Automated by `npm run test:stories:matrix:ci`. WCAG 1.3.1, 4.1.2. |
| MUST | The component remains legible and operable under a real browser forced-colors: active pass. | Automated by `npm run test:stories:hc`. |
| MUST | A human completed an end-to-end accessibility review of this component. | Manual review, last on 2026-11-04. |
| MUST NOT | Maintainers: Do not bypass design tokens or skip forced-colors verification at beta. | Release review; not machine-checked. |

## Install and import

- In-repo only. GridBlock is not exported from `@digitaltableteur/react`, so there is no public import path.

## Links

- Machine-readable contract (Design System Contract 1.0): https://www.digitaltableteur.com/contracts/v1/GridBlock.contract.json
- Markdown version of this page: https://www.digitaltableteur.com/design-system/components/grid-block.md
- Component index as JSON: https://www.digitaltableteur.com/design-system/components.json
- All components: https://www.digitaltableteur.com/design-system/components
- Source: The implementation lives in a private repository. This page, its Markdown twin and the contract are generated from it at build time and are the public source of truth.
