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 sets the width of the content: the padding stands outside it, so the container itself may grow to the size plus its padding on both sides. A navbar, a hero, a brand bar and a footer with the same max do the same, so on a wide screen they all start their content at one line. All sizes use design tokens with sensible fallbacks. A size wider than the preview, lg and up, fills it as full does; the difference shows on a wider screen.
Padding
Control the horizontal padding with the padding prop. Useful for ensuring content doesn't touch screen edges on smaller viewports. padding="lg" is the padding the navbar, the hero and the brand bar use, so with it the container's content stands on their line at every width; the default md stands a little further out on a screen narrower than the container.
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 |
|---|---|---|
--padding-wk-x-sm |
0.625rem |
Small horizontal padding |
--padding-wk-x-md |
0.75rem |
Medium horizontal padding, the default |
--padding-wk-x-lg |
1rem |
Large horizontal padding |
--padding-wk-x-xl |
1.5rem |
XL horizontal padding |