Skip to content

Container

Centers content horizontally with a configurable max-width and padding. Container decides how wide a region is, so pair it with Stack, Cluster, Grid, or Split to arrange the content inside.

Import

import { Container } from "@hyzer-labs/ui"

Demo

max="sm" · 640px
max="md" · 968px
max="lg" · 1200px
max="xl" · 1440px
max="full" · no cap
<Container max="sm" center={false}>…</Container>
<Container max="md" center={false}>…</Container>
<Container max="lg" center={false}>…</Container>
<Container max="xl" center={false}>…</Container>
<Container max="full" center={false}>…</Container>

Props

NameTypeDefaultNote
max'sm' | 'md' | 'lg' | 'xl' | 'full''lg'
padding'none' | 'sm' | 'md' | 'lg' | 'near' | 'away''md'Both axes. Shared LayoutPadding scale — near/away tighten inside data-density-shift regions.
paddingInline'none' | 'sm' | 'md' | 'lg' | 'near' | 'away'Per-axis override — wins over padding on the inline axis. Same LayoutPadding scale.
paddingBlock'none' | 'sm' | 'md' | 'lg' | 'near' | 'away'Per-axis override — wins over padding on the block axis. Same LayoutPadding scale.
centerbooleantrue
breakoutbooleanfalseEscapes the parent column to span the nearest inline-size container (viewport when none). Overrides max.
asstring'div'
classstringMerged after the hz-container class.
childrenSnippet

Theme hooks

What this component promises your CSS. The reference theme styles exactly these — from @layer hz-theme, so your unlayered rules win. See Styling Components for the how.

Root class: .hz-container

Data attributes

HookValuesStyles
data-max'sm' | 'md' | 'lg' | 'xl' | 'full'Selects which --hz-width-* token caps the column. Default lg.
data-padding'none' | 'sm' | 'md' | 'lg' | 'near' | 'away'Padding on both axes. Default md.
data-centerpresent when centeredApplies margin-inline: auto. Present by default.
data-breakoutpresent when breaking outEscapes the column to span the nearest inline-size container.

Custom properties

HookValuesStyles
--hz-breakout-shift<length> — default calc(50% - 50cqw)Breakout alignment offset. The default assumes a centered column; set it to 0 in a start-aligned layout so the bleed only grows rightward.

Accessibility

Container is a layout primitive with no ARIA semantics. Use the as prop to render a meaningful landmark element (e.g. as='main') where that fits.