Skip to content
THE COMPONENT LIBRARY
Skip to content

Component reference

Container

Constrain a composition's reading width.

Preview

Live preview

Changes apply to this preview only.

Stable
Documentation layoutA wide container for the body, a narrower one for the reading column below.

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

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.

Open preview

Gutter

padding uses the spacing scale; it applies to the inline axis so vertical rhythm stays with the content.

Open preview

Alignment

centered (default) centers the capped box; centered={false} keeps it at the inline start.

Open preview

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
PimoluContainerProps public API
NameTypeDefaultDescription
asElementType | undefined`div`Element rendered by the container. Defaults to `div`.
maxWidthPimoluContainerMaxWidth | undefined"lg"Maximum inline size. The width itself always stays fluid (`100%`), so the container is responsive at every breakpoint.
paddingPimoluContainerSpace | undefined`4` (16px)Horizontal padding. Defaults to `4` (16px).
centeredboolean | undefinedtrueCenter the box when it is narrower than its parent.
defaultValuestring | number | readonly string[] | undefined—Standard React/HTML attribute.
classNamestring | undefined—Standard React/HTML attribute.
styleCSSProperties | undefined—Standard React/HTML attribute.
aria-labelstring | undefined—Defines a string value that labels the current element.
childrenReactNode—Standard React/HTML attribute.
onChangeChangeEventHandler<HTMLElement, Element> | undefined—Standard React/HTML attribute.
onClickMouseEventHandler<HTMLElement> | undefined—Standard React/HTML attribute.
as

ElementType | undefined

Default: `div`

Element rendered by the container. Defaults to `div`.

maxWidth

PimoluContainerMaxWidth | undefined

Default: "lg"

Maximum inline size. The width itself always stays fluid (`100%`), so the container is responsive at every breakpoint.

padding

PimoluContainerSpace | undefined

Default: `4` (16px)

Horizontal padding. Defaults to `4` (16px).

centered

boolean | undefined

Default: true

Center the box when it is narrower than its parent.

defaultValue

string | number | readonly string[] | undefined

No default extracted.

Standard React/HTML attribute.

className

string | undefined

No default extracted.

Standard React/HTML attribute.

style

CSSProperties | undefined

No default extracted.

Standard React/HTML attribute.

aria-label

string | undefined

No default extracted.

Defines a string value that labels the current element.

children

ReactNode

No default extracted.

Standard React/HTML attribute.

onChange

ChangeEventHandler<HTMLElement, Element> | undefined

No default extracted.

Standard React/HTML attribute.

onClick

MouseEventHandler<HTMLElement> | undefined

No default extracted.

Standard React/HTML attribute.

Accessibility

  • Verify content reflows at zoom and does not create a horizontal page scrollbar.
Read the accessibility guide →