Container
XS · 350B gzip budgetA centred, max-width content column.
- Category
- Media & layout
- Budget
- xs, static display primitive
- External runtime
- React / React DOM only
axe fixtureSSR rendersource scanbundle budget
Preview
Live fixtureContent
Try the component here. Locale-aware formatting and direction follow the selected language; example content and labels are not automatically translated. Overlay demos use interactive launchers.
Install
npx shadcn@latest add https://gear5-ui.vercel.app/r/container.jsonCopies the source into your project. Pulls in 1 shared registry item: cn.
New here? Set up Tailwind and import aliases first →Source & props
Edit on GitHub ↗Prop types and inline documentation are included below. This is repository source; the installer rewrites shared imports for your project.
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
Quality contract- 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