Section
Semantic section wrapper with spacing and background tokens.
Status: stable. Group: layout. Markdown version: /design-system/components/section.md
When to use
Section is the page-level band: it owns vertical rhythm (spacing, responsive paddings) and surface (background), while Container inside it owns the horizontal clamp. hero and follow are a pair; the hero band keeps a generous top and tight bottom, and the section right after uses follow to avoid a double gap. inverse flips to the dark surface with matching text tokens. Give sections an id when they are anchor or skip targets.
When not to use
- Do not nest Sections; bands are siblings; nesting compounds paddings and backgrounds.
- Do not use Section inside a component or card; it is page architecture, not component padding.
- Do not use Section inside components or cards; it is page architecture, not component padding.
Look-alikes
Props
| Prop | Type | Default | Description | Required |
|---|---|---|---|---|
children | ReactNode | none | Section content. | Yes |
spacing | "sm" | "md" | "lg" | "xl" | "none" | "hero" | "follow" | md | Block padding scale. | No |
background | "default" | "muted" | "accent" | "inverse" | default | Surface background token. | No |
className | string | none | Section class names. | No |
id | string | none | Section id (anchor target). | No |
spotlightTarget | string | none | Optional stable selector target for host-app guided navigation. | No |
Variants
- Available spacings:
none,sm,md,lg,xl,hero,follow(defaultmd). - Available backgrounds:
default,muted,accent,inverse(defaultdefault).
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. |
| SHOULD | Pair spacing="hero" on the page hero with spacing="follow" on the next section; that is what kills the double gap. | Not stated in the contract. |
| SHOULD | Alternate background="muted" sparingly to group related content; every-other-band zebra striping reads as noise. | Not stated in the contract. |
| SHOULD | Put a Container directly inside; Section handles vertical, Container horizontal. | Not stated in the contract. |
| SHOULD | Give anchor/deep-link targets an id, and use spotlightTarget only when the host app needs stable guided-navigation selectors. | Not stated in the contract. |
| SHOULD NOT | Do not nest Sections; bands are siblings; nesting compounds paddings and backgrounds. | Not stated in the contract. |
Install and import
- Install:
npm install @digitaltableteur/react(version 0.9.1, restricted access on npm). - Import:
import { Section } from "@digitaltableteur/react"; - Entry point:
@digitaltableteur/react/layoutexports it too. - Styles: import
@digitaltableteur/react/style.cssonce at the app boundary. - Also available as the custom element
<dt-section>; see the custom elements manifest.
Links
- Machine-readable contract (Design System Contract 1.0)
- Markdown version of this page
- Component index as JSON
- All 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.