Skip to Content

Container

Keep the content area within a certain width, plus appropriate margins on the left and right.

Usage

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cill

<div data-unitone-layout="container"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cill </div>

Props

HTML -gutters:{variation} / JSX gutters={variation}

Gutters.

Can be set from -3 to 7. For variations 2 and above, clamp is used to adjust the margins so that they do not become too large on small screens. If it is 1 or more, adding s will shrink it to size -1 on mobile. (e.g. 1s) If it is 2 or more, adding m will shrink it to size 1 on mobile. (e.g. 2m)

<div data-unitone-layout="container -gutters:-2"> ... </div>

HTML --unitone--max-width / JSX maxWidth={value}

Max width.

<div data-unitone-layout="container" style="--unitone--max-width: 400px"> ... </div>

HTML -align:{value} / JSX align={value}

Alignment of the container.

start / center / end

<div data-unitone-layout="container -align:end" style="--unitone--max-width: 400px"> ... </div>

HTML -container-type:{value} / JSX containerType={value}

Establishes the Container as a query container for its descendants.

Currently supported values are:

  • inline-size
<div data-unitone-layout="container -container-type:inline-size"> <div>...</div> </div>

HTML -responsive-context:{value} / JSX responsiveContext={value}

Sets the responsive context for descendants to container, the only supported value. It does not affect the Container element itself. Use responsiveContext="container" together with containerType="inline-size" on this element (HTML: -responsive-context:container -container-type:inline-size). The default is viewport-based behavior, and there is no viewport override inside a container context. The context becomes active only when both markers are on the same element. If containerType="inline-size" is omitted, responsiveContext="container" is ignored and the existing responsive context remains active. See Responsive context utilities for examples.

Deprecated HTML -fluid-reference:{value} / JSX fluidReference={value}

Deprecated. Use responsiveContext="container" on an ancestor instead.

Uses a query container’s inline size as the reference for fluid typography, spacing, padding, and gutters.

Currently supported values are:

  • cqw

Place the Container inside an ancestor with container-type: inline-size.

<div data-unitone-layout="container -container-type:inline-size"> <div data-unitone-layout="container -fluid-reference:cqw"> ... </div> </div>
Last updated on