Skip to content

Layouts

Layout utilities provide fine-grained control over flexbox properties, gap spacing, and alignment. They set CSS properties directly, making them straightforward to use and inspect.

Control the direction of flex items.

ClassSets
.flex-columnflex-direction: column
.flex-rowflex-direction: row
ClassSets
.flex-nowrapflex-wrap: nowrap
.flex-wrapflex-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-0flex-grow: 0
.flex-grow-1flex-grow: 1
.flex-grow-2flex-grow: 2
.flex-grow-3flex-grow: 3
.flex-grow-4flex-grow: 4
.flex-grow-5flex-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-0flex-shrink: 0
.flex-shrink-1flex-shrink: 1
.flex-shrink-2flex-shrink: 2
.flex-shrink-3flex-shrink: 3
.flex-shrink-4flex-shrink: 4
.flex-shrink-5flex-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-3xs
.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>.

PrefixSetsExample
gap-gap (both axes).gap-lg
col-gap-column-gap (inline axis).col-gap-sm
row-gap-row-gap (block axis).row-gap-xl

All three accept the same size scale: none, 3xs, 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="p-md">Card 1</div>
<div class="p-md">Card 2</div>
<div class="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.