The width of a page's content: centred, as wide as its size and no wider, with room at the sides on a phone.
$ pnpm dlx shadcn@latest add @dashral/containerInstallation
$ pnpm dlx shadcn@latest add @dashral/containerAdds the component, the components it builds on, its npm packages and the theme tokens it uses. Or by its full URL: https://dashral.com/r/container.json
When to use
- The width of a page's content: an article, a settings page, every part of a landing page.
When not to use
- A landing page's part with a heading: Section, which has a Container inside.
- A box with a border and a background: Card.
Usage
Centred and no wider than its size, with room at the sides on a phone.
import { Container } from "@/components/dashral/container"
export default function Article() {
return (
<Container size="sm" className="py-12">
<h1 className="text-3xl font-semibold">Faster exports</h1>
<p className="mt-4 text-muted-foreground">Large tables now stream to the file as they're read.</p>
</Container>
)
}Using the npm package? Import from @dashral/ui/components/container instead, here and in the examples; the rest is the same.
Examples
API reference
Container
Also takes every prop of <div>(opens in a new tab).
| Prop | Type | Default |
|---|---|---|
size | "sm" | "md" | "lg" | "xl" | "full"How wide the content gets: 42rem, 56rem, 72rem, 80rem, or the whole width. | "lg" |
padded | booleanRoom at the sides, 16px and 24px from sm up, outside the size, so content never touches a phone's edge. | true |
asChild | booleanIts classes on your own element, e.g. a <main> or an <article>. | false |
className | stringExtra classes, merged with cn() so yours win. | — |