Skip to main content

Flexbox Utilities

Flexbox utilities allow you to build flexible layouts using the CSS Flexbox system.

A flex container enables powerful alignment and distribution of space between elements.

Before using flex utilities, the container must have the flex or inline-flex class.

<div class="flex">
<div>Item</div>
<div>Item</div>
</div>

Flex Direction

Flex direction controls the main axis of a flex container.


Row

Items are arranged horizontally.

Example

<div class="flex flex-row gap-4">
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
</div>

Class Reference

ClassCSS
flex-rowflex-direction: row

Column

Items are arranged vertically.

Example

<div class="flex flex-col gap-2">
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
</div>

Class Reference

ClassCSS
flex-colflex-direction: column

Flex Wrap

Flex wrapping controls whether items should wrap onto multiple lines.


Wrap

Items move to the next line when there is not enough space.

Example

<div class="flex flex-wrap gap-4">
<div>Card</div>
<div>Card</div>
<div>Card</div>
<div>Card</div>
</div>

Class Reference

ClassCSS
flex-wrapflex-wrap: wrap

No Wrap

Items stay on a single line even if they overflow.

Example

<div class="flex flex-nowrap gap-4">
<div>Item</div>
<div>Item</div>
<div>Item</div>
</div>

Class Reference

ClassCSS
flex-nowrapflex-wrap: nowrap

Align Items

Align items controls vertical alignment inside a flex container.


Start

Items align to the start of the cross axis.

<div class="flex items-start">
ClassCSS
items-startalign-items: flex-start

Center

Items align to the center.

<div class="flex items-center">
ClassCSS
items-centeralign-items: center

End

Items align to the end.

<div class="flex items-end">
ClassCSS
items-endalign-items: flex-end

Stretch

Items stretch to fill the container height.

<div class="flex items-stretch">
ClassCSS
items-stretchalign-items: stretch

Justify Content

Justify utilities control horizontal distribution of items.


Start

Items align to the start.

<div class="flex justify-start">
ClassCSS
justify-startjustify-content: flex-start

Center

Items align to the center.

<div class="flex justify-center">
ClassCSS
justify-centerjustify-content: center

End

Items align to the end.

<div class="flex justify-end">
ClassCSS
justify-endjustify-content: flex-end

Space Between

Items are evenly distributed with space between them.

<div class="flex justify-between">
ClassCSS
justify-betweenjustify-content: space-between

Complete Flex Class List

NUI CSS provides the following flex utilities.

flex-row
flex-col

flex-wrap
flex-nowrap

items-start
items-center
items-end
items-stretch

justify-start
justify-center
justify-end
justify-between

These utilities map directly to CSS Flexbox properties and enable flexible layout systems.