Container
freeContainer keeps the contents of page bands centered with a responsive width constraint.
Preview
Dark
Store settings
Customer-facing details and checkout preferences.
import Button from '@/components/ui/Button';
import Container from '@/components/composites/Container';
export default function UsageDemo() {
return (
<div className="w-full">
<Container
asElement="header"
size="md"
className="flex min-h-16 items-center justify-between gap-4 px-4 py-3"
>
<div className="min-w-0">
<h5 className="text-lg font-semibold">
Store settings
</h5>
<p className="text-muted-foreground">
Customer-facing details and checkout preferences.
</p>
</div>
<Button variant="solid">
Save changes
</Button>
</Container>
</div>
);
}Installation
Add this component with the NateUI CLI.
npx nateui@latest add ContainerAPI
Container always applies Tailwind's container and mx-auto classes. sm and md add their own maximum widths; lg leaves the base container width unchanged.
| Prop | Description | Type | Default |
|---|---|---|---|
asElement | Element or component rendered as the container root. | React.ElementType | 'div' |
size | Responsive width constraint applied in addition to Tailwind's base container class. | ContainerSize | 'lg' |
className | Additional classes applied to the container root. | string | — |
children | Content aligned inside the container. | ReactNode | — |
ref | Ref forwarded to the rendered root element. | Ref | — |
...rest | Remaining props for asElement. | ComponentPropsWithRef<T> | — |
Types
type ContainerSize = 'sm' | 'md' | 'lg';sm adds max-w-[800px], md adds max-w-[1200px], and lg adds no extra maximum width beyond Tailwind's container utility.