Container

free

Container 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 Container

API

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.

PropDescriptionTypeDefault
asElementElement or component rendered as the container root.React.ElementType'div'
sizeResponsive width constraint applied in addition to Tailwind's base container class.ContainerSize'lg'
classNameAdditional classes applied to the container root.string
childrenContent aligned inside the container.ReactNode
refRef forwarded to the rendered root element.Ref
...restRemaining 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.