Layout
Container
Centred content column with page gutters. wide = layout.wide (page), narrow = layout.narrow (running text). The only way to limit width.
- Ready
- No keyboard interaction
- No screen reader interaction
Playground
Change the props. The controls come from the documented props.
Longer running text sits on the narrow width, so lines stay easy to read.
<Container>
<p className="text-secondary">
Longer running text sits on the narrow width, so lines stay easy to read.
</p>
</Container>Usage
When to use
Use a container to limit the width of page content and give it page gutters. It is the only way to set a content width in a screen.
When not to use
- Inside another Container: the widths would fight.
- When you need a full section with rhythm and a divider: use Section, which brings its own Container.
How it works
wide follows layout.wide for full pages, narrow follows layout.narrow for running text. The container is centred and keeps the side gutters on every screen size.
Content guidelines
Use narrow wherever people read more than a few sentences in a row; lines that run too long are hard to follow.
Do and don’t
Content
DoOne Container: the content gets the page gutters once. Content
Don’tNested Containers add the gutters twice.
Do
- Put page content in a Container or Section.
- narrow for longer text.
Don’t
- No max-w-* utilities in screens; widths only through Container.
- Don't nest Containers.
Anatomy
The parts of the component and what each one does, as in the playground above.
- containermax width from layout tokens, gutters 24px mobile, 32px from md.
Examples
Type-checked, and the same code goes into the AI manifest. Import: import { Container } from "@/ds";
narrow for running text
Longer running text sits on the narrow width, so lines stay easy to read.
Props
Checked against the component's TypeScript type on every build.
| Name | Type | Default | Description |
|---|---|---|---|
| size | "wide" | "narrow" | "wide" | layout.wide or layout.narrow. |
| as | "div" | "main" | "header" | "footer" | "article" | "div" | Semantic element. |
| children (required) | ReactNode | – | Content. |
Tokens used
Derived from the utility classes in the component's source. Copy a class with one click.
| Token | Tier | Value | Utility |
|---|---|---|---|
| container.paddingX.desktop | component | 32px | |
| container.paddingX.mobile | component | 24px | |
| layout.narrow | semantic | 720px | |
| layout.wide | semantic | 1280px | |
| text.secondary | semantic | #555555 |
Accessibility
What is checked automatically on every build, and what a person has tested. Nothing is marked as tested unless it was.
| Check | How | Status |
|---|---|---|
| axe-core rules | Automated on every npm run check, at desktop and mobile width | Runs on every build |
| Keyboard | Automated Playwright test (scripts/keyboard.mjs) | Not applicable |
| Screen reader | Manual | Not applicable |
Semantics and focus
- as="main" for the main content when no Section carries it.