naUI
Components Layout

Flex

Flex utilities and named layout patterns: stack, cluster, split, row.

Overview

naUI ships two layers of flex tooling:

  • Atomic utilities - single-property classes like na-flex, na-items-center, na-justify-between.
  • Named layout patterns - one-class shortcuts (na-stack, na-cluster, na-split, na-row) that bundle the most common combinations.

Display

ClassProperty
na-flexdisplay: flex
na-inline-flexdisplay: inline-flex

Direction

ClassProperty
na-flex-rowflex-direction: row
na-flex-columnflex-direction: column

Wrap

ClassProperty
na-flex-wrapflex-wrap: wrap
na-flex-nowrapflex-wrap: nowrap

Flex sizing

ClassPropertyUse
na-flex-1flex: 1 1 0%Fill remaining space
na-flex-autoflex: 1 1 autoGrow & shrink based on content
na-flex-noneflex: noneFixed size, no shrink
na-flex-shrink-0flex-shrink: 0Prevent shrink

Alignment

ClassProperty
na-items-startalign-items: flex-start
na-items-centeralign-items: center
na-items-endalign-items: flex-end
na-items-stretchalign-items: stretch
na-items-baselinealign-items: baseline
na-justify-startjustify-content: flex-start
na-justify-centerjustify-content: center
na-justify-endjustify-content: flex-end
na-justify-betweenjustify-content: space-between
na-justify-aroundjustify-content: space-around
na-justify-evenlyjustify-content: space-evenly
na-self-startalign-self: flex-start
na-self-centeralign-self: center
na-self-endalign-self: flex-end
na-self-stretchalign-self: stretch

Gap

ClassValue
na-gap-10.25rem
na-gap-20.5rem
na-gap-30.75rem
na-gap-41rem
na-gap-61.5rem
na-gap-82rem

Named layout patterns

Single-class shortcuts that bundle alignment + direction + gap into a common layout pattern.

Stack

Vertical column with equal gap between children.

Item 1
Item 2
Item 3
ClassGap
na-stack-s0.5rem
na-stack1rem (default)
na-stack-l2rem
na-stack-xl3rem
<div class="na-stack">
  <div>Item 1</div>
  <div>Item 2</div>
  <div>Item 3</div>
</div>

Cluster

Wrapping inline row - items flow left and wrap when they run out of room. Perfect for tag groups and toolbar buttons.

naUI CSS Open Source Layout Zero deps
ClassGap
na-cluster-s0.5rem
na-cluster0.75rem (default)
na-cluster-l1.5rem
<div class="na-cluster">
  <span class="na-badge na-badge-primary">naUI</span>
  <span class="na-badge na-badge-secondary">CSS</span>
  <span class="na-badge na-badge-success">Open Source</span>
</div>

Split

Pushes the first and last child to opposite ends. Common for toolbars, list rows, and card footers.

Section title View all
<div class="na-split">
  <span>Section title</span>
  <a href="#" class="na-button na-button-ghost na-button-s">View all</a>
</div>

Row

Horizontal row with vertically centred children and a consistent gap.

Row item label
Supporting text here
ClassGap
na-row-s0.5rem
na-row1rem (default)
na-row-l2rem
<div class="na-row">
  <img src="avatar.jpg" class="na-avatar">
  <div>
    <div>Jane Doe</div>
    <div>Engineer</div>
  </div>
</div>

Flex center

Centers children on both axes - ideal for hero banners, empty states, and icon buttons.

Perfectly centred
<div class="na-flex-center" style="min-height:200px">
  <p>Perfectly centred</p>
</div>

Flex cover

na-flex-cover is an absolute overlay that fills its positioned parent and centres children. Use it for loading spinners, image overlays, and empty state layers.

<div class="na-relative" style="min-height:160px">
  <img src="cover.jpg" class="na-width-full na-height-full" style="object-fit:cover">
  <div class="na-flex-cover" style="background:rgba(0,0,0,.4)">
    <span style="color:#fff">Overlay text</span>
  </div>
</div>

Class reference

ClassDescription
na-flexdisplay: flex
na-inline-flexdisplay: inline-flex
na-flex-row / colSet direction
na-flex-wrap / nowrapSet wrapping
na-flex-1 / auto / noneFlex grow/shrink shorthands
na-flex-shrink-0Prevent shrink
na-items-start / center / end / stretch / baselinealign-items
na-justify-start / center / end / between / around / evenlyjustify-content
na-self-start / center / end / stretchalign-self on a child
na-gap-1/2/3/4/6/8gap utility
na-stack / sm / lg / xlVertical stack pattern
na-cluster / sm / lgWrapping inline row pattern
na-splitSpace-between row pattern
na-row / sm / lgHorizontal row with gap pattern
na-flex-centerCentre both axes
na-flex-coverAbsolute fill + centre children