Skip to content

Layouts

Layout utilities provide fine-grained control over flexbox properties, gap spacing, and alignment. They work through custom properties, making them composable and easy to override at any scope.

PropertyDefaultDescription
--tng-flex-directionrowMain axis direction
--tng-flex-wrapnowrapWhether items wrap to new lines
--tng-flex-basisautoDefault size of a flex item
--tng-flex-grow0How much an item grows
--tng-flex-shrink1How much an item shrinks
PropertyDefaultDescription
--tng-gap--tng-spacing-mdUniform gap
--tng-col-gapFalls back to --tng-gapColumn (inline) gap
--tng-row-gapFalls back to --tng-gapRow (block) gap
PropertyDefaultDescription
--tng-align-contentnormalMulti-line cross-axis alignment
--tng-align-itemsnormalItem cross-axis alignment
--tng-align-selfautoIndividual item cross-axis
--tng-justify-contentnormalMain-axis content distribution
--tng-justify-itemsnormalDefault justify for items
--tng-justify-selfautoIndividual item main-axis

Control the direction of flex items.

ClassSets
.flex-column--tng-flex-direction: column
.flex-row--tng-flex-direction: row
ClassSets
.flex-wrap--tng-flex-wrap: wrap

Control how flex items grow to fill available space. A higher value means the item claims a proportionally larger share of the extra space.

ClassSets
.flex-grow-0--tng-flex-grow: 0
.flex-grow-1--tng-flex-grow: 1
.flex-grow-2--tng-flex-grow: 2
.flex-grow-3--tng-flex-grow: 3
.flex-grow-4--tng-flex-grow: 4
.flex-grow-5--tng-flex-grow: 5

Control how flex items shrink when space is limited. A higher value means the item gives up more space relative to its siblings.

ClassSets
.flex-shrink-0--tng-flex-shrink: 0
.flex-shrink-1--tng-flex-shrink: 1
.flex-shrink-2--tng-flex-shrink: 2
.flex-shrink-3--tng-flex-shrink: 3
.flex-shrink-4--tng-flex-shrink: 4
.flex-shrink-5--tng-flex-shrink: 5

Gap utilities control the spacing between items in any flex or grid layout. They use the same spacing tokens as padding, margin, and inset utilities, keeping all spacing consistent.

.gap-none
.gap-2xs
.gap-xs
.gap-sm
.gap-md
.gap-lg
.gap-xl
.gap-2xl
.gap-3xl
.gap-4xl
.gap-5xl
.gap-6xl
.gap-7xl
.gap-8xl
.gap-9xl
.gap-10xl
.gap-11xl
.gap-12xl
.gap-13xl
.gap-14xl
.gap-15xl
.gap-16xl
.gap-17xl
.gap-18xl

By default, .gap-<size> sets both column and row gap. To control each axis independently, use .col-gap-<size> or .row-gap-<size>.

PrefixPropertyExample
gap---tng-gap (both axes).gap-lg
col-gap---tng-col-gap (inline axis only).col-gap-sm
row-gap---tng-row-gap (block axis only).row-gap-xl

All three accept the same size scale: none, 2xs, xs, sm, md, lg, xl, 2xl … up to 18xl.

<!-- Tight columns, spacious rows -->
<div class="tng-group col-gap-xs row-gap-xl flex-wrap">
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
</div>

See the full spacing tokens reference for exact values per brand.

Alignment utilities control how items are distributed and positioned within flex and grid containers. They affect both the content (how lines or tracks are distributed) and items (how individual items sit within their allocated space).

Control how lines are distributed in a multi-line flex container (when flex-wrap is enabled) or grid tracks along the block axis.

ClassValue
.align-content-space-aroundspace-around
.align-content-space-betweenspace-between
.align-content-space-evenlyspace-evenly
.align-content-baselinebaseline
.align-content-stretchstretch
.align-content-startstart
.align-content-centercenter
.align-content-endend

Control how flex items are aligned along the cross axis (block axis in row layouts, inline axis in column layouts).

ClassValue
.align-items-baselinebaseline
.align-items-stretchstretch
.align-items-startstart
.align-items-centercenter
.align-items-endend

Override the parent’s align-items for a single item.

ClassValue
.align-self-baselinebaseline
.align-self-stretchstretch
.align-self-startstart
.align-self-centercenter
.align-self-endend

Control how flex items are distributed along the main axis (inline axis in row layouts, block axis in column layouts).

ClassValue
.justify-content-space-aroundspace-around
.justify-content-space-betweenspace-between
.justify-content-space-evenlyspace-evenly
.justify-content-startstart
.justify-content-centercenter
.justify-content-endend

Set the default justification for all items in a grid container.

ClassValue
.justify-items-baselinebaseline
.justify-items-stretchstretch
.justify-items-startstart
.justify-items-centercenter
.justify-items-endend

Override the parent’s justify-items for a single item.

ClassValue
.justify-self-baselinebaseline
.justify-self-stretchstretch
.justify-self-startstart
.justify-self-centercenter
.justify-self-endend
<!-- Horizontal nav with items centered vertically, spread apart -->
<nav class="tng-group justify-content-space-between align-items-center">
<a href="/">Home</a>
<a href="/about">About</a>
<a href="/contact">Contact</a>
</nav>
<!-- Vertical stack with items centered horizontally -->
<div class="tng-stack align-items-center gap-lg">
<h2>Title</h2>
<p>Description</p>
<button class="tng-button is-primary">Action</button>
</div>
<!-- Card grid with equal-height cards -->
<div class="tng-grid gap-md align-items-stretch">
<div class="tng-box p-md">Card 1</div>
<div class="tng-box p-md">Card 2</div>
<div class="tng-box p-md">Card 3</div>
</div>
  • Let layouts set display — layout components like .tng-group, .tng-stack, and .tng-grid already set display: flex or display: grid. These utilities only override the related properties — they don’t set display themselves.
  • Use gap instead of margins between items — gap is simpler (no “last child” edge cases), works in both flex and grid, and uses the same token scale as all other spacing.
  • Prefer align-items over align-self — set alignment once on the parent when all children should align the same way. Reserve align-self for individual exceptions.