Skip to content

Container

XS, under 350B gzipped

A centred, max-width content column.

Category
Media & layout
Budget
xs, static display primitive
Runtime deps
None

Preview

Preview language
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.json

Copies 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

← All components