# Gallery

> Masonry image grid with optional captions that appear on hover and keyboard focus, and a slight scale on hover and focus unless the user prefers reduced motion. Items open nothing. Used on work-detail and editorial pages where the imagery is the primary content.

- Status: stable
- Group: media
- Page: https://www.digitaltableteur.com/design-system/components/gallery
- Contract: https://www.digitaltableteur.com/contracts/v1/Gallery.contract.json

## When to use

Masonry image grid with captions revealed on hover and keyboard focus, used on case-study pages. Items open nothing. Provide meaningful alt text per image.

## When not to use

- Do not use as a navigation surface; gallery items are not links.
- Do not put content in a caption that the page does not repeat elsewhere when touch users matter: captions show only on hover and focus.

## Look-alikes

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

## Props

| Prop | Type | Default | Description | Required |
| --- | --- | --- | --- | --- |
| `images` | `GalleryImage[]` | none | No description in the contract. | Yes |
| `minColumnWidth` | `number` | `320` | Accepted for API compatibility but not used: the column count follows fixed breakpoints (1 below 600px, 2 below 900px, 3 below 1200px, then 4). | No |
| `gutter` | `number` | `32` | No description in the contract. | No |

## Variants

No variant dimensions and no props with a fixed set of values.

## Invalid combinations

The contract records no invalid combinations.

## Keyboard

| Key | Behaviour |
| --- | --- |
| Tab | Focuses each gallery item and reveals its caption. |

## 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 | ARIA: Each item is a figure; the image alt text and the figcaption describe it. | Not yet verified: no evidence record. WCAG 4.1.2. |
| MUST | ARIA: Items are focusable only so keyboard users can reveal captions; they have no action. | Not yet verified: no evidence record. WCAG 4.1.2. |
| 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 | Positional, scale, and opacity motion is suppressed under prefers-reduced-motion. | Manual review, last on 2026-11-04. WCAG 2.2.2, 2.3.3. |
| MUST | Every documented keyboard interaction works as specified. | Not yet verified: no evidence record. WCAG 2.1.1, 2.1.2. |
| MUST | A human completed an end-to-end accessibility review of this component. | Manual review, last on 2026-11-04. |

## Install and import

- Install: `npm install @digitaltableteur/react` (version 0.9.1, restricted access on npm).
- Import: `import { Gallery } from "@digitaltableteur/react";`
- Entry point: `@digitaltableteur/react/content` exports it too.
- Styles: import `@digitaltableteur/react/style.css` once at the app boundary.
- Also available as the custom element `<dt-gallery>`; see the custom elements manifest.

## Links

- Machine-readable contract (Design System Contract 1.0): https://www.digitaltableteur.com/contracts/v1/Gallery.contract.json
- Markdown version of this page: https://www.digitaltableteur.com/design-system/components/gallery.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.
