# StoryBlock

> Narrative section for Work case studies with a subtitle and title, rich text, and images arranged by a selectable layout.

- Status: stable
- Group: structure
- Page: https://www.digitaltableteur.com/design-system/components/story-block
- Contract: https://www.digitaltableteur.com/contracts/v1/StoryBlock.contract.json

## When to use

StoryBlock is the workhorse narrative section of Work case studies: a subtitle/title pair, rich text content, and images arranged by imageLayout, over background and spacing knobs. Chain several StoryBlocks (with GridBlock mosaics and ProcessBlock) to build a project page's spine.

## 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 |
| --- | --- | --- | --- | --- |
| `subtitle` | `string` | none | Optional subtitle/category label. | No |
| `title` | `string` | none | Main title of the story section. | Yes |
| `content` | `React.ReactNode[]` | none | Body content as array of paragraphs or React nodes. | Yes |
| `images` | `StoryImage \| StoryImage[]` | none | Image or images to display. Without imageLayout they render as single (one image) or grid (several); imageLayout="none" hides them. | No |
| `imageLayout` | `"single" \| "none" \| "grid"` | none | Image layout: "single" (1 col), "grid" (2 col when there is more than one image) or "none" (images hidden). When omitted, passed images render as "single" for one image and "grid" for several. | No |
| `backgroundColor` | `"transparent" \| "light" \| "white"` | `transparent` | Background color variant; defaults to transparent. It colours the root element and never changes which element that is. | No |
| `maxWidth` | `"sm" \| "md" \| "lg" \| "full" \| "xl"` | `md` | Maximum width constraint; defaults to md. | No |
| `spacing` | `"compact" \| "default" \| "comfortable" \| "spacious"` | `comfortable` | Spacing variant; defaults to comfortable. | No |
| `className` | `string` | `""` | Additional CSS class. | No |
| `as` | `"article" \| "div" \| "section"` | `section` | Root element, also when a background color is set. The inner PageLayout wrapper is always a <div>, so sections never nest. Defaults to "section". | No |
| `ariaLabel` | `string` | none | Accessible label for the section or article (defaults to the title). Not applied when as="div", since a generic element cannot be named. | No |
| `headingLevel` | `2 \| 3 \| 4` | `2` | Heading level for the section title; visual size is unchanged. Defaults to 2 (a section directly under the page h1); pass 3 or 4 when the block sits under a deeper heading. | No |

## Variants

- Allowed `imageLayout` values: `single`, `none`, `grid`.
- 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`).
- Allowed `headingLevel` values: `2`, `3`, `4` (default `2`).

## 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 | ARIA: The wrapper is named by ariaLabel, falling back to title, so every StoryBlock rendered as a section is a region landmark; a page with many StoryBlocks gets many landmarks. With as="div" no aria-label is set, since a generic element cannot be named. | Not yet verified: no evidence record. WCAG 4.1.2. |
| MUST | ARIA: The root is always the as element (default section), whatever the background; the inner PageLayout wrapper is a div, so sections never nest. | Not yet verified: no evidence record. WCAG 4.1.2. |
| MUST | ARIA: Subtitle is a Text kicker, not a heading; the title's heading level comes from headingLevel (default 2) | 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 | 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. StoryBlock 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/StoryBlock.contract.json
- Markdown version of this page: https://www.digitaltableteur.com/design-system/components/story-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.
