Container

The Container component centers content within a responsive maximum width and provides optional horizontal padding.

Usage & Examples

Constrained Content

Contained contentThis surface stays within a medium-width content area.
constrained-content.tsx
const tileStyle = {
  boxSizing: "border-box",
  display: "flex",
  flexDirection: "column",
  justifyContent: "center",
  width: "100%",
  height: "100%",
  minHeight: "4.5rem",
  padding: "1rem",
  border: "1px solid var(--border-color)",
  borderRadius: "var(--border-radius-md, 0.75rem)",
  background: "var(--background-color-surface)",
};

<Container size="md" padded>
  <div style={tileStyle}>
    <strong>Contained content</strong>
    <span>This surface stays within a medium-width content area.</span>
  </div>
</Container>

Props API

10 props
Columns
Container props API
Default
Description
alignLayoutAlignNopropsAlign prop for LayoutPrimitive.
asElementTypeNopropsAs prop for LayoutPrimitive.
childrenReactNodeNopropsContent rendered inside the component.
classNamestringNostylingAdditional CSS class names for the component root.
data-testidstringNotestingTest id used to identify the component in tests.
gapLayoutGapNoprops"md"Gap.
justifyLayoutJustifyNopropsJustify prop for LayoutPrimitive.
paddedbooleanNopropsfalsePadded.
size"sm" | "md" | "lg" | "xl" | "full"Nostyling"lg"Size.
testIdstringNopropsTest id used to identify the component in tests.