Skip to main content

Overview

The Container component provides a centered layout wrapper with automatic max-width and consistent horizontal padding. It uses CSS custom properties for flexible max-width configuration.

Usage

import { Container } from "@kuzenbo/core";

export default function Page() {
  return (
    <Container>
      <section className="border-border bg-card text-card-foreground space-y-4 rounded-lg border p-6">
        <header className="space-y-1">
          <p className="text-muted-foreground text-sm">Release summary</p>
          <p className="text-base font-medium">
            Q2 component adoption is up 18% across product surfaces
          </p>
        </header>
        <ul className="text-muted-foreground space-y-2 text-sm">
          <li>49 components migrated to semantic color tokens.</li>
          <li>
            Regression suite stayed green across all package workspaces.
          </li>
          <li>Design and engineering handoff time dropped to one sprint.</li>
        </ul>
      </section>
    </Container>
  );
}

Narrow Container

For prose-heavy content, you can constrain the max-width:
import { Container } from "@kuzenbo/core";

export default function Article() {
  return (
    <Container className="max-w-3xl">
      <article className="border-border bg-card text-card-foreground space-y-4 rounded-lg border p-6">
        <p className="text-muted-foreground text-sm">Field note</p>
        <p className="text-base">
          The narrow variant is tuned for prose-heavy content like changelog
          entries, implementation guides, and migration walkthroughs.
        </p>
        <p className="text-muted-foreground text-sm">
          Teams can keep reading comfort high without sacrificing layout
          consistency.
        </p>
      </article>
    </Container>
  );
}

Props

className
string
Additional CSS classes to apply to the container.
style
React.CSSProperties
Inline styles to apply to the container. The component uses --kb-container-max-width CSS custom property (defaults to 86rem).
The Container component extends all standard HTML div element props (ComponentProps<"div">).

Customization

You can customize the max-width using CSS custom properties:
import { Container } from "@kuzenbo/core";

export default function CustomWidth() {
  return (
    <Container style={{ "--kb-container-max-width": "72rem" } as React.CSSProperties}>
      {/* Content */}
    </Container>
  );
}
Or via global CSS:
:root {
  --kb-container-max-width: 72rem;
}

Accessibility

The Container is a semantic div wrapper and includes a data-slot="container" attribute for styling and testing purposes.

Build docs developers (and LLMs) love