Container
XS, under 350B gzippedA centred, max-width content column.
- Category
- Media & layout
- Budget
- xs, static display primitive
- Runtime deps
- None
Preview
Content
This is the exact fixture the conformance suite renders in CI. Switch the language to see the component mirror and reformat.
Install
npx shadcn@latest add https://kata-ui-rho.vercel.app/r/container.jsonCopies the source into your project. Pulls in 1 primitive: cn.
Source
import { cn } from "../lib/cn";
export interface ContainerProps {
children: React.ReactNode;
/** Max width in Tailwind's scale. */
size?: "sm" | "md" | "lg" | "xl";
className?: string;
}
const SIZES = { sm: "max-w-2xl", md: "max-w-4xl", lg: "max-w-6xl", xl: "max-w-7xl" } as const;
/**
* A centred, max-width content column. Horizontal padding uses `px-`, which
* Tailwind already resolves to logical `padding-inline` — no separate RTL
* handling needed for a symmetric container.
*/
export function Container({ children, size = "lg", className }: ContainerProps) {
return <div className={cn("mx-auto w-full px-5", SIZES[size], className)}>{children}</div>;
}
What CI checks
- Bundled, minified and gzipped against its tier budget
- Audited by axe in the state previewed above
- Rendered through react-dom/server with no browser globals
- Scanned for network calls, dangerous sinks, and unguarded animation