Container
Centres content and caps its width, with gutters that scale from phone to desktop — the outer shell for every page.
Install
Install the component
Add the source straight into your project with the shadcn CLI — no package dependency to track.
npx shadcn@latest add https://vert-ui.dev/r/container.jsonPreview
Live preview
sm · max-w-3xl
xl · max-w-7xl
Usage
Examples
Default page shell
default · max-w-6xl
<Container>
<h1>Page title</h1>
<p>Centred, capped at 6xl with responsive gutters.</p>
</Container>Full-bleed with inner padding
nested containers
<Container size="full" className="bg-muted/40">
<Container>Inner content stays readable</Container>
</Container>Reference
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| size | "sm" | "md" | "lg" | "xl" | "full" | "lg" | Maximum content width: 3xl, 5xl, 6xl, 7xl or unbounded. |
| padded | boolean | true | Adds px-4 / sm:px-6 / lg:px-8 gutters that scale with the viewport. |
| maxWidth | string | — | Arbitrary max-width (any CSS length). Overrides size. |
| gutter | string | — | Arbitrary gutter (any CSS length), used instead of the padded scale. |
| asChild | boolean | false | Render the child element instead of a div — keeps the styles, defers semantics. |
| className | string | — | Merged last, so you can override width or padding. |
Accessibility
Accessibility notes
- Purely presentational: a div by default and a child element via asChild, so you choose the landmark (main, section, nav) that fits the content.
- Gutters keep content clear of the viewport edge at every width, which reduces horizontal scrolling and cramped touch targets on phones.
- No fixed heights — the container grows with its content and never causes layout shift.