Container
A width-constrained wrapper that centers content horizontally. Use it to control the maximum width and inline padding of page sections.
Basic Usage
Max Width Sizes
The max prop controls the maximum width of the container. All sizes use design tokens with sensible fallbacks.
Padding
Control the horizontal padding with the padding prop. Useful for ensuring content doesn't touch screen edges on smaller viewports.
Without Centering
By default the container is centered via mx-auto. Set :center="false" to disable this.
Semantic Elements
Use the as prop to render a semantic HTML element instead of a div.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
max |
string | 'xl' |
Max width: sm, md, lg, xl, 2xl, full |
padding |
string | 'md' |
Horizontal padding: none, sm, md, lg, xl |
center |
bool | true |
Center the container horizontally with mx-auto |
as |
string | 'div' |
HTML element to render |
scope |
string|null | null |
Scoped personalization name |
Keyboard Interaction
This component is a layout wrapper. Keyboard interaction is delegated to its children.
Design Tokens
The container sizes use dedicated tokens with CSS fallbacks:
| Token | Default | Description |
|---|---|---|
--size-wk-container-sm |
40rem |
Small container max width |
--size-wk-container-md |
48rem |
Medium container max width |
--size-wk-container-lg |
64rem |
Large container max width |
--size-wk-container-xl |
80rem |
XL container max width |
--size-wk-container-2xl |
96rem |
2XL container max width |
Padding tokens:
| Token | Default | Description |
|---|---|---|
--space-wk-sm |
0.5rem |
Small horizontal padding |
--space-wk-md |
1rem |
Medium horizontal padding |
--space-wk-lg |
1.5rem |
Large horizontal padding |
--space-wk-xl |
2.5rem |
XL horizontal padding |