Mixins of the flex, grid and container layouts. Each one can be called directly with @include or by name inside apply(). See Flex, Grid and Container for guides.
This page is generated from the doc blocks in the core source when the site is built, so it always matches the current release of @nuvoui/core. Every example is compiled against core during the build; open Compiled CSS under an example to see its output. The A to Z index lists every public mixin and function.
Makes an element full width and centres it on the inline axis (margin-inline: auto).
@mixincontainer-base
Example
.page {
@includecontainer-base;
@includemax-width(1200px);
}
Compiled CSS
.page {
width: 100%;
margin-inline: auto;
max-width: 1200px;
}
See also: container. Source: layouts/_container.scss:18
container-paddingmixin
Sets padding-top and padding-bottom to the same spacing value.
@mixincontainer-padding($padding)
Parameter
Type
Default
Description
$padding
Number|Length
Required
A $spacings key (4 gives var(--nu-space-4)) or a value with units, passed through raw
Example
.section {
@includecontainer-padding(8); // padding-top and padding-bottom: var(--nu-space-8)
}
Compiled CSS
.section {
padding-top: var(--nu-space-8);
padding-bottom: var(--nu-space-8);
}
Note.A unitless number that is not a spacing key, or a negative key, raises @error.
See also: container, py. Source: layouts/_container.scss:32
containermixin
Builds a centred, full-width container whose max-width steps up at each breakpoint (breakpoint width minus 100px), with block padding of spacing key 4 (top and bottom only, as in v1).
@mixincontainer($display: block)
Parameter
Type
Default
Description
$display
String
block
Display value: block, flex, grid, inline-block, inline-flex, inline-grid, flow-root, a CSS-wide keyword or var(); anything else raises an error
Sets justify-content to flex-end, packing items at the end of the main axis.
@mixinend
Example
.actions {
@includeapply(flex, end, gap(2));
}
Compiled CSS
.actions {
display: flex;
justify-content: flex-end;
gap: var(--nu-space-2);
}
.actions>* {
--nu-flex-gap: var(--nu-space-2);
}
See also: start, center. Source: layouts/_flex.scss:159
centermixin
Sets justify-content to center, centring items on the main axis.
@mixincenter
Example
.hero {
@includeapply(flex, center, x-center);
}
Compiled CSS
.hero {
display: flex;
justify-content: center;
align-items: center;
}
See also: x-center. Source: layouts/_flex.scss:170
stretchmixin
Makes the direct children of a flex container share the main axis equally (each child gets flex: 1 1 0%). Takes no argument; when one child must be wider, give it a fill-{n} or no-grow class.
Sizes a flex child to span a number of columns out of $column-count (12 by default), subtracting the container gap from --nu-flex-gap.
@mixinfill($size)
Parameter
Type
Default
Description
$size
Number
Required
Whole number of columns to span, from 1 to $column-count; a fraction, 0, a negative number, more than $column-count, a value with a unit or a non-number raises an error
Output
flex: 0 0 <width>; max-width: <width>; min-width: 0, where width is a calc() over 100% and var(--nu-flex-gap)
Example
.sidebar {
@includefill(4); // one third of the row, minus its share of the gap
Note.Gap mixins set --nu-flex-gap on direct children, so place the item directly inside the gap container; without a gap it reads the registered initial value 0px.
Creates as many columns of at least $min-width as fit, collapsing empty tracks so items stretch to fill the row.
@mixinauto-fit($min-width)
Parameter
Type
Default
Description
$min-width
Length|String
Required
Minimum column width: a $grid-item-sizes key (xs, sm, md, lg, xl; sm gives 250px by default), a length or percentage, calc() or var(), or a whole minmax() track used as written; a unitless number or unknown word raises an error
See also: auto-fill. Source: layouts/_grid.scss:125
auto-fillmixin
Creates as many columns of at least $min-width as fit, keeping empty tracks so items keep their column width.
@mixinauto-fill($min-width)
Parameter
Type
Default
Description
$min-width
Length|String
Required
Minimum column width: a $grid-item-sizes key (xs, sm, md, lg, xl; sm gives 250px by default), a length or percentage, calc() or var(), or a whole minmax() track used as written; a unitless number or unknown word raises an error
Sets grid-auto-flow to column, placing items column by column; same as the .flow-col class.
@mixinflow-col
Example
.list {
@includegrid;
@includerows(3);
@includeflow-col;
}
Compiled CSS
.list {
display: grid;
grid-template-rows: repeat(3, minmax(0, 1fr));
grid-auto-flow: column;
}
See also: flow-row. Source: layouts/_grid.scss:175
flow-densemixin
Sets grid-auto-flow to dense so later items back-fill earlier gaps; same as the .flow-dense class.
@mixinflow-dense
Example
.masonry {
@includegrid;
@includeflow-dense;
}
Compiled CSS
.masonry {
display: grid;
grid-auto-flow: dense;
}
See also: flow-row. Source: layouts/_grid.scss:187
justifymixin
Sets justify-items, aligning grid items along the inline axis of their cells. Grid only: for flex containers use the flex justify mixins (start, center, between).
@mixinjustify($value)
Parameter
Type
Default
Description
$value
String
Required
Any justify-items value, such as start, end, center or stretch
Example
.cards {
@includeapply(grid, cols(3), justify(center));
}
Compiled CSS
.cards {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
justify-items: center;
}
See also: align, place. Source: layouts/_grid.scss:209
alignmixin
Sets align-items, aligning grid items along the block axis of their cells. Grid only: for flex containers use the x-* mixins (x-center, x-start).
@mixinalign($value)
Parameter
Type
Default
Description
$value
String
Required
Any align-items value, such as start, end, center or stretch
Example
.cards {
@includegrid;
@includealign(start);
}
Compiled CSS
.cards {
display: grid;
align-items: start;
}
See also: justify, place. Source: layouts/_grid.scss:222
placemixin
Sets place-items, aligning grid items on both axes of their cells at once. Grid only.
@mixinplace($value)
Parameter
Type
Default
Description
$value
String
Required
Any place-items value, such as center or start end
Example
.icon-grid {
@includegrid;
@includeplace(center);
}
Compiled CSS
.icon-grid {
display: grid;
place-items: center;
}
See also: justify, align. Source: layouts/_grid.scss:235
col-spanmixin
Makes a grid item span a number of columns.
@mixincol-span($span)
Parameter
Type
Default
Description
$span
Number|String
Required
Number of columns to span: a whole number of 1 or more, calc() or var(); anything else raises an error