Skip to content

Layout

The layout bundle provides classes for display, flex/grid stacking, alignment, sizing, overflow, positioning, and visibility.

Import

js
import '@nikelaz/nadir/dist/nadir-layout.min.css';

Or as part of the full bundle:

js
import '@nikelaz/nadir/dist/nadir.min.css';

Display

Classdisplay
.blockblock
.inline-blockinline-block
.inlineinline
.flexflex
.inline-flexinline-flex
.gridgrid
.inline-gridinline-grid
.hiddennone

Stacking

Stacking classes set up flex or grid containers with a directional flow. They are the primary building block for most layouts.

ClassDescription
.stack-xHorizontal flex row (display: flex; flex-direction: row)
.stack-yVertical flex column (display: flex; flex-direction: column)
.stack-zLayered grid — children overlap each other (display: grid; grid-template: 1fr / 1fr)

Combine with spacing gap classes to add space between items:

html
<div class="stack-x gap-md">
  <div>Item 1</div>
  <div>Item 2</div>
</div>

Flex Modifiers

Control how flex children grow, shrink, and fill available space.

ClassPropertyValue
.flex-1flex1 1 0%
.flex-autoflex1 1 auto
.flex-noneflexnone
.growflex-grow1
.no-growflex-grow0
.shrinkflex-shrink1
.no-shrinkflex-shrink0

Alignment

Container Alignment (align-items)

ClassPropertyValue
.align-startalign-itemsstart
.align-centeralign-itemscenter
.align-endalign-itemsend

Container Justification (justify-content)

ClassPropertyValue
.justify-startjustify-contentstart
.justify-centerjustify-contentcenter
.justify-endjustify-contentend
.justify-betweenjustify-contentspace-between
.justify-aroundjustify-contentspace-around

Self Alignment

ClassPropertyValue
.align-self-startalign-selfstart
.align-self-centeralign-selfcenter
.align-self-endalign-selfend
.justify-self-startjustify-selfstart
.justify-self-centerjustify-selfcenter
.justify-self-endjustify-selfend

Sizing

ClassPropertyValue
.w-fullwidth100%
.w-screenwidth100vw
.w-autowidthauto
.w-fitwidthfit-content
.w-minwidthmin-content
.w-maxwidthmax-content
.h-fullheight100%
.h-screenheight100vh
.h-autoheightauto
.h-fitheightfit-content
.min-w-0min-width0
.min-h-0min-height0
.max-w-fullmax-width100%
.max-h-fullmax-height100%

.min-w-0 is particularly useful inside flex containers where children can overflow — browsers default to min-width: auto for flex items, which prevents shrinking below the content size.

Overflow

ClassPropertyValue
.overflow-hiddenoverflowhidden
.overflow-autooverflowauto
.overflow-scrolloverflowscroll
.overflow-visibleoverflowvisible
.overflow-x-hiddenoverflow-xhidden
.overflow-x-autooverflow-xauto
.overflow-x-scrolloverflow-xscroll
.overflow-y-hiddenoverflow-yhidden
.overflow-y-autooverflow-yauto
.overflow-y-scrolloverflow-yscroll

Truncate

.truncate clips a single line of text with an ellipsis:

html
<p class="truncate w-full">This long text will be clipped with an ellipsis...</p>

It sets overflow: hidden, text-overflow: ellipsis, and white-space: nowrap together.

Aspect Ratio

Classaspect-ratio
.aspect-square1 / 1
.aspect-video16 / 9
.aspect-autoauto

Object Fit

For controlling how images and videos fill their containers:

Classobject-fit
.object-covercover
.object-containcontain
.object-fillfill
.object-nonenone
.object-scale-downscale-down

Position

Classposition
.staticstatic
.relativerelative
.absoluteabsolute
.fixedfixed
.stickysticky

Inset Utilities

ClassEffect
.inset-0top: 0; right: 0; bottom: 0; left: 0
.inset-x-0left: 0; right: 0
.inset-y-0top: 0; bottom: 0
.top-0top: 0
.right-0right: 0
.bottom-0bottom: 0
.left-0left: 0

Visibility

ClassEffect
.visiblevisibility: visible
.invisiblevisibility: hidden — hides the element but preserves its space in the layout
.sr-onlyVisually hidden but readable by screen readers

.sr-only is the standard pattern for accessible icon buttons and form labels that need a visual equivalent but must remain in the accessibility tree.

Wrapping

Classflex-wrap
.wrapwrap