Component reference
Container
Constrain a composition's reading width.
Preview
Live previewOptional six-digit hex. Clear to restore the preset. Check contrast with your brand color.
Changes apply to this preview only.
Reading column
The outer container caps the page at 1024px; the inner one narrows the prose to 640px without a second media query. The gutter is removed here because the outer container already provides it.
Width adapts to the available space
"use client";
import {
Container,
Stack,
Box,
HStack,
Badge,
Text,
Heading,
Paragraph,
Button
} from "@pimolu/react";
export function DemoExample() {
return (
<Container maxWidth="lg" padding={0}>
<Stack gap={4}>
<Box padding={6} background="muted">
<HStack gap={3} align="center" wrap>
<Badge variant="success">Stable</Badge>
<Stack gap={1}>
<Text weight="medium">Documentation layout</Text>
<Text size="sm" tone="muted">
A wide container for the body, a narrower one for the reading
column below.
</Text>
</Stack>
</HStack>
</Box>
<Container maxWidth="sm" padding={0}>
<Stack gap={3}>
<Heading level={3} size="md">Reading column</Heading>
<Paragraph size="sm" tone="muted">
The outer container caps the page at 1024px; the inner one
narrows the prose to 640px without a second media query. The
gutter is removed here because the outer container already
provides it.
</Paragraph>
<HStack gap={2} wrap>
<Button size="sm">Read the guide</Button>
<Button size="sm" appearance="outline">View source</Button>
</HStack>
</Stack>
</Container>
</Stack>
</Container>
);
}More examples
Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.
Max widths
Every container stays width: 100%; the max-width only caps it when the viewport is wider.
Gutter
padding uses the spacing scale; it applies to the inline axis so vertical rhythm stays with the content.
Alignment
centered (default) centers the capped box; centered={false} keeps it at the inline start.
Usage
Use Container for page width and application layout, leaving component spacing local.
API reference
Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.
PimoluContainerProps
Type source| Name | Type | Default | Description |
|---|---|---|---|
as | ElementType | undefined | `div` | Element rendered by the container. Defaults to `div`. |
maxWidth | PimoluContainerMaxWidth | undefined | "lg" | Maximum inline size. The width itself always stays fluid (`100%`), so the container is responsive at every breakpoint. |
padding | PimoluContainerSpace | undefined | `4` (16px) | Horizontal padding. Defaults to `4` (16px). |
centered | boolean | undefined | true | Center the box when it is narrower than its parent. |
defaultValue | string | number | readonly string[] | undefined | — | Standard React/HTML attribute. |
className | string | undefined | — | Standard React/HTML attribute. |
style | CSSProperties | undefined | — | Standard React/HTML attribute. |
aria-label | string | undefined | — | Defines a string value that labels the current element. |
children | ReactNode | — | Standard React/HTML attribute. |
onChange | ChangeEventHandler<HTMLElement, Element> | undefined | — | Standard React/HTML attribute. |
onClick | MouseEventHandler<HTMLElement> | undefined | — | Standard React/HTML attribute. |
asElementType | undefinedDefault: `div`
Element rendered by the container. Defaults to `div`.
maxWidthPimoluContainerMaxWidth | undefinedDefault: "lg"
Maximum inline size. The width itself always stays fluid (`100%`), so the container is responsive at every breakpoint.
paddingPimoluContainerSpace | undefinedDefault: `4` (16px)
Horizontal padding. Defaults to `4` (16px).
centeredboolean | undefinedDefault: true
Center the box when it is narrower than its parent.
defaultValuestring | number | readonly string[] | undefinedNo default extracted.
Standard React/HTML attribute.
classNamestring | undefinedNo default extracted.
Standard React/HTML attribute.
styleCSSProperties | undefinedNo default extracted.
Standard React/HTML attribute.
aria-labelstring | undefinedNo default extracted.
Defines a string value that labels the current element.
childrenReactNodeNo default extracted.
Standard React/HTML attribute.
onChangeChangeEventHandler<HTMLElement, Element> | undefinedNo default extracted.
Standard React/HTML attribute.
onClickMouseEventHandler<HTMLElement> | undefinedNo default extracted.
Standard React/HTML attribute.
Accessibility
- Verify content reflows at zoom and does not create a horizontal page scrollbar.