On this page

Layout

Container

Constrain content and establish a local size container.

Container fills its available inline size up to maxInlineSize and centres itself. Pass a container.* preset for a fixed maximum in rem. Its numeric suffix is the maximum in CSS pixels at a 16px root. The maximum scales with the root font size. For other widths, set the maximum on a Box style, such as style={{ maxInlineSize: '80ch' }}. Pass marginInline to change the centring. Read Layout to choose a layout component.

Container: Basic
Loading Container: Basic example

Responsive descendants

A traditional container usually only constrains and centres content. Luke UI's Container also establishes a local responsive query boundary.

Luke UI responsive values inside the Container resolve against its content box rather than the document root. A container.672 Container therefore never reaches bp768. paddingInline reduces the content-box width, so it can also change where responsive styles switch.

Use Container when descendants should respond to the available content area rather than the document root.

Choose the rendered element

Container uses Box's elementType and renderRoot contract.

Container: Main
Loading Container: Main example

API

ContainerProps also accepts compatible DOM and ARIA attributes and event handlers for its rendered element.

NameTypeDefault
alignSelf
<"auto" |⁠ "baseline" |⁠ "center" |⁠ "flex-end" |⁠ "flex-start" |⁠ "normal" |⁠ "stretch"> |⁠ undefined—
blockSize
<"0" |⁠ "100%" |⁠ "auto" |⁠ "fit-content" |⁠ "max-content" |⁠ "min-content"> |⁠ undefined—
borderBlockEndWidth
<"none" |⁠ "thick" |⁠ "thin"> |⁠ undefined—
borderBlockStartWidth
<"none" |⁠ "thick" |⁠ "thin"> |⁠ undefined—
borderInlineEndWidth
<"none" |⁠ "thick" |⁠ "thin"> |⁠ undefined—
borderInlineStartWidth
<"none" |⁠ "thick" |⁠ "thin"> |⁠ undefined—
flexBasis
<"0" |⁠ "100%" |⁠ "auto" |⁠ "content" |⁠ "fit-content" |⁠ "max-content" |⁠ "min-content"> |⁠ undefined—
flexGrow
<"0" |⁠ "1"> |⁠ undefined—
flexShrink
<"0" |⁠ "1"> |⁠ undefined—
inset
<"0" |⁠ "auto" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
insetBlock
<"0" |⁠ "auto" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
insetBlockEnd
<"0" |⁠ "auto" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
insetBlockStart
<"0" |⁠ "auto" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
insetInline
<"0" |⁠ "auto" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
insetInlineEnd
<"0" |⁠ "auto" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
insetInlineStart
<"0" |⁠ "auto" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
justifySelf
<"auto" |⁠ "center" |⁠ "end" |⁠ "normal" |⁠ "start" |⁠ "stretch"> |⁠ undefined—
margin
<"0" |⁠ "auto" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
marginBlock
<"0" |⁠ "auto" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
marginBlockEnd
<"0" |⁠ "auto" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
marginBlockStart
<"0" |⁠ "auto" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
marginInline
<"0" |⁠ "auto" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefinedauto

Inline margin around the container.

marginInlineEnd
<"0" |⁠ "auto" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
marginInlineStart
<"0" |⁠ "auto" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
maxBlockSize
<"0" |⁠ "100%" |⁠ "fit-content" |⁠ "max-content" |⁠ "min-content" |⁠ "none"> |⁠ undefined—
maxInlineSize*
—

Maximum inline size of the container's border box.

minBlockSize
<"0" |⁠ "100%" |⁠ "auto" |⁠ "fit-content" |⁠ "max-content" |⁠ "min-content"> |⁠ undefined—
minInlineSize
<"0" |⁠ "100%" |⁠ "auto" |⁠ "fit-content" |⁠ "max-content" |⁠ "min-content"> |⁠ undefined—
order
<number> |⁠ undefined—
overflow
<"auto" |⁠ "clip" |⁠ "hidden" |⁠ "scroll" |⁠ "visible"> |⁠ undefined—
overflowX
<"auto" |⁠ "clip" |⁠ "hidden" |⁠ "scroll" |⁠ "visible"> |⁠ undefined—
overflowY
<"auto" |⁠ "clip" |⁠ "hidden" |⁠ "scroll" |⁠ "visible"> |⁠ undefined—
overscrollBehavior
<"auto" |⁠ "contain"> |⁠ undefined—
padding
<"0" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
paddingBlock
<"0" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
paddingBlockEnd
<"0" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
paddingBlockStart
<"0" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
paddingInline
<"0" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—

Padding inside the container's query box.

paddingInlineEnd
<"0" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
paddingInlineStart
<"0" |⁠ "space.4" |⁠ "space.8" |⁠ "space.12" |⁠ "space.16" |⁠ "space.24" |⁠ "space.32" |⁠ "space.40" |⁠ "space.48" |⁠ "space.64" |⁠ "space.96"> |⁠ undefined—
placeSelf
<"auto" |⁠ "center" |⁠ "end" |⁠ "normal" |⁠ "start" |⁠ "stretch"> |⁠ undefined—
position
<"absolute" |⁠ "fixed" |⁠ "relative" |⁠ "static" |⁠ "sticky"> |⁠ undefined—