Skip to main content

Gap Utilities

Gap utilities in NuvoUI help you control the spacing between child elements in flex and grid layouts, creating consistent separation between items.

Configuration​

The gap utilities are built on configurable variables:

Spacing Scale​

Gap utilities use the same spacing scale as other spacing utilities:

Basic Gap​

Control spacing between elements in flex and grid layouts using the .gap-{size} utility:

Directional Gaps​

Control horizontal and vertical gaps independently:

Different Gap Sizes​

Apply different gap sizes to control spacing density:

Combining Directional Gaps​

Use different horizontal and vertical gaps for more complex layouts:

Responsive Gaps​

Apply different gaps at different breakpoints:

Auto Gap​

Use the .gap-auto utility for browser-determined gap:

Common Use Cases​

Card Grid Layout​

Button Group with Consistent Spacing​

Form Layout​

Visual Gap Comparison​

Compare different gap sizes:

Gap Utilities Reference Table​

Basic Gap Classes​

ClassCSS PropertyDescription
.gap-0gap: 0No gap
.gap-1gap: 0.25remExtra small gap (4px)
.gap-2gap: 0.5remSmall gap (8px)
.gap-3gap: 0.75remMedium small gap (12px)
.gap-4gap: 1remMedium gap (16px)
.gap-5gap: 1.25remMedium large gap (20px)
.gap-6gap: 1.5remLarge gap (24px)
.gap-8gap: 2remExtra large gap (32px)
.gap-10gap: 2.5rem2x large gap (40px)
.gap-12gap: 3rem3x large gap (48px)
.gap-16gap: 4rem4x large gap (64px)
.gap-20gap: 5rem5x large gap (80px)
.gap-24gap: 6rem6x large gap (96px)
.gap-32gap: 8rem8x large gap (128px)
.gap-40gap: 10rem10x large gap (160px)
.gap-48gap: 12rem12x large gap (192px)
.gap-56gap: 14rem14x large gap (224px)
.gap-64gap: 16rem16x large gap (256px)
.gap-autogap: autoBrowser-determined gap

Directional Gap Classes​

ClassCSS PropertyDescription
.gap-x-0 to .gap-x-64column-gap: [value]Horizontal gap between items
.gap-y-0 to .gap-y-64row-gap: [value]Vertical gap between items

Responsive Gap Classes​

Add @{breakpoint} suffix to any gap class for responsive behavior:

  • .gap-4@sm
  • .gap-x-6@md
  • .gap-y-8@lg
  • .gap-auto@xl

SCSS Mixins​

NuvoUI provides gap mixins for use in your SCSS:

Gap Mixins​

MixinParametersDescription
@include gap($val)$val: Gap valueSets gap on all sides
@include gap-x($val)$val: Gap valueSets horizontal gap (column-gap)
@include gap-y($val)$val: Gap valueSets vertical gap (row-gap)

Example SCSS Usage​

Advanced Component Building​

Use gap mixins to create flexible, responsive layouts: