align-baseline mixin
Sets vertical-align to baseline (inline and table cell content).
@mixin align-baselineExample
.icon { @include align-baseline;}Compiled CSS
.icon { vertical-align: baseline;}Mixins behind the utility classes, grouped by source file. Each one can be called directly with @include or by name inside apply(), with a state and a breakpoint after it.
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.
align-baseline align-top align-middle align-bottom
align-baseline mixinSets vertical-align to baseline (inline and table cell content).
@mixin align-baselineExample
.icon { @include align-baseline;}.icon { vertical-align: baseline;}align-top mixinSets vertical-align to top (inline and table cell content).
@mixin align-topExample
td { @include align-top;}td { vertical-align: top;}align-middle mixinSets vertical-align to middle (inline and table cell content).
@mixin align-middleExample
.avatar { @include align-middle;}.avatar { vertical-align: middle;}align-bottom mixinSets vertical-align to bottom (inline and table cell content).
@mixin align-bottomExample
td { @include align-bottom;}td { vertical-align: bottom;}ensure-keyframes animate-bounce hover-ready animate-pulse animate-spin animate-ping animate-fade animate-shake
ensure-keyframes mixinEmits an @keyframes rule with the given name once per compilation, at the root of the stylesheet (outside @media, @supports, @container and @scope, inside any @layer); later calls with the same name emit nothing.
@mixin ensure-keyframes($name)| Parameter | Type | Default | Description |
|---|---|---|---|
$name | String | Required | Keyframes name |
Example
.toast { animation: toast-in 0.3s ease-out; @include ensure-keyframes(toast-in) { from { opacity: 0; } to { opacity: 1; } }}.toast { animation: toast-in 0.3s ease-out;}@keyframes toast-in { from { opacity: 0; } to { opacity: 1; }}animate-bounce mixinSets an animation that moves the element to a horizontal and vertical offset and back, and emits its keyframes once.
@mixin animate-bounce($props: ())| Parameter | Type | Default | Description |
|---|---|---|---|
$props | Map | () | Overrides for vertical (0.5rem), horizontal (0), duration (1s), timing (ease-in-out), iteration (infinite); offsets are lengths, and a unitless number other than 0 raises an error |
Example
.scroll-hint { @include animate-bounce((vertical: 10px, duration: 2s));}.scroll-hint { animation: anim-bounce-0-10px 2s ease-in-out infinite;}@keyframes anim-bounce-0-10px { 0%, 100% { transform: translate(0, 0); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); } 50% { transform: translate(0, 10px); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }}hover-ready mixinAdds a transition on all properties with the default duration and easing tokens ($transition-default-duration, $transition-default-ease) so hover changes animate.
@mixin hover-readytransition-property: all; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out)Example
.card { @include hover-ready;}.card { transition-property: all; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out);}animate-pulse mixinSets an animation that fades opacity between a maximum and a minimum, and emits its keyframes once.
@mixin animate-pulse($props: ())| Parameter | Type | Default | Description |
|---|---|---|---|
$props | Map | () | Overrides for min-opacity (0.5), max-opacity (1), duration (1s), timing (ease-in-out), iteration (infinite) |
Example
.skeleton { @include animate-pulse((min-opacity: 0.4, duration: 1.5s));}.skeleton { animation: anim-pulse-40-100 1.5s ease-in-out infinite;}@keyframes anim-pulse-40-100 { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; }}animate-spin mixinSets a full 360 degree rotation animation (any direction other than normal spins backwards), and emits its keyframes once.
@mixin animate-spin($props: ())| Parameter | Type | Default | Description |
|---|---|---|---|
$props | Map | () | Overrides for direction (normal), duration (1s), timing (linear), iteration (infinite) |
Example
.spinner { @include animate-spin((duration: 0.8s));}.spinner { animation: anim-spin-normal 0.8s linear infinite;}@keyframes anim-spin-normal { from { transform: rotate(0deg); } to { transform: rotate(360deg); }}animate-ping mixinSets an animation that scales the element up while fading it out, and emits its keyframes once.
@mixin animate-ping($props: ())| Parameter | Type | Default | Description |
|---|---|---|---|
$props | Map | () | Overrides for scale (2), duration (1s), timing (cubic-bezier(0, 0, 0.2, 1)), iteration (infinite) |
Example
.status-dot { @include animate-ping((scale: 3));}.status-dot { animation: anim-ping-30 1s cubic-bezier(0, 0, 0.2, 1) infinite;}@keyframes anim-ping-30 { 75%, 100% { transform: scale(3); opacity: 0; }}animate-fade mixinSets a fade animation of type in, out, in-up or in-down (the up and down types also slide 20px), and emits its keyframes once; any other type raises an error.
@mixin animate-fade($props: ())| Parameter | Type | Default | Description |
|---|---|---|---|
$props | Map | () | Overrides for type (in), duration (0.5s), timing (ease-in-out), iteration (1 forwards) |
Example
.modal { @include animate-fade((type: in-up, duration: 0.3s));}.modal { animation: anim-fade-in-up 0.3s ease-in-out 1 forwards;}@keyframes anim-fade-in-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); }}animate-shake mixinSets a horizontal shake animation of the given intensity, and emits its keyframes once per intensity and unit (5px and 5rem get separate keyframes).
@mixin animate-shake($props: ())| Parameter | Type | Default | Description |
|---|---|---|---|
$props | Map | () | Overrides for intensity (5px; a length, a unitless number other than 0 raises an error), duration (0.5s), timing (ease-in-out), iteration (1) |
Example
.input-invalid { @include animate-shake((intensity: 8px));}.input-invalid { animation: anim-shake-8px 0.5s ease-in-out 1;}@keyframes anim-shake-8px { 0%, 100% { transform: translateX(0); } 10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); } 20%, 40%, 60%, 80% { transform: translateX(8px); }}backdrop-filter backdrop-layer backdrop-blur backdrop-brightness backdrop-contrast backdrop-grayscale backdrop-hue-rotate backdrop-invert backdrop-saturate backdrop-sepia backdrop-frosted backdrop-glass backdrop-dark-glass backdrop-crystal backdrop-matte backdrop-none generate-backdrop-filter-utilities
backdrop-filter mixinSets backdrop-filter to the given value as written, replacing any composed or preset filter.
@mixin backdrop-filter($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | String | Required | Any backdrop-filter value, such as blur(6px) saturate(140%) or none |
Example
.overlay { @include backdrop-filter(blur(6px) saturate(140%));}.overlay { -webkit-backdrop-filter: blur(6px) saturate(140%); backdrop-filter: blur(6px) saturate(140%);}backdrop-layer mixinResets every backdrop filter variable to its identity value and writes the backdrop-filter that combines them; include it before the filter mixins.
@mixin backdrop-layerEight --nu-backdrop-* identity values and backdrop-filter: var(--nu-backdrop-blur) ... var(--nu-backdrop-sepia)Example 1
.overlay { @include backdrop-layer; @include backdrop-blur(md);}.overlay { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); --nu-backdrop-blur: blur(4px);}Example 2
.overlay { @include apply(backdrop-layer, backdrop-blur(lg), backdrop-saturate(150%));}.overlay { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); --nu-backdrop-blur: blur(8px); --nu-backdrop-saturate: saturate(150%);}Note. A filter mixin included before backdrop-layer in the same rule is reset by it.
backdrop-blur mixinSets the --nu-backdrop-blur variable to blur() with a configured key or a validated raw value; it has no visible effect without backdrop-layer.
@mixin backdrop-blur($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|String | Required | A $backdrop-blur-values key (none, sm, md, lg, xl, 2xl), a length in px, rem or em, calc() or var(); anything else raises an error |
Example 1
.overlay { @include backdrop-layer; @include backdrop-blur(md);}.overlay { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); --nu-backdrop-blur: blur(4px);}Example 2
.overlay { @include apply(backdrop-layer, backdrop-blur(6px));}.overlay { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); --nu-backdrop-blur: blur(6px);}backdrop-brightness mixinSets the --nu-backdrop-brightness variable to brightness() with a configured key or a validated raw value; it has no visible effect without backdrop-layer.
@mixin backdrop-brightness($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|String | Required | A $backdrop-brightness-values key (none, 75, 90, 110, 125, 150; unquoted and quoted numbers both match), a percentage, calc() or var(); anything else raises an error |
Example 1
.overlay { @include backdrop-layer; @include backdrop-brightness(90);}.overlay { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); --nu-backdrop-brightness: brightness(90%);}Example 2
.overlay { @include apply(backdrop-layer, backdrop-brightness(80%));}.overlay { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); --nu-backdrop-brightness: brightness(80%);}backdrop-contrast mixinSets the --nu-backdrop-contrast variable to contrast() with a configured key or a validated raw value; it has no visible effect without backdrop-layer.
@mixin backdrop-contrast($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|String | Required | A $backdrop-contrast-values key (none, 75, 90, 110, 125, 150; unquoted and quoted numbers both match), a percentage, calc() or var(); anything else raises an error |
Example 1
.overlay { @include backdrop-layer; @include backdrop-contrast(125);}.overlay { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); --nu-backdrop-contrast: contrast(125%);}Example 2
.overlay { @include apply(backdrop-layer, backdrop-contrast(120%));}.overlay { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); --nu-backdrop-contrast: contrast(120%);}backdrop-grayscale mixinSets the --nu-backdrop-grayscale variable to grayscale() with a configured key or a validated raw value; it has no visible effect without backdrop-layer.
@mixin backdrop-grayscale($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|String | Required | A $backdrop-grayscale-values key (none, 25, 50, 75, 100; unquoted and quoted numbers both match), a percentage, calc() or var(); anything else raises an error |
Example 1
.overlay { @include backdrop-layer; @include backdrop-grayscale(50);}.overlay { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); --nu-backdrop-grayscale: grayscale(50%);}Example 2
.overlay { @include apply(backdrop-layer, backdrop-grayscale(30%));}.overlay { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); --nu-backdrop-grayscale: grayscale(30%);}backdrop-hue-rotate mixinSets the --nu-backdrop-hue-rotate variable to hue-rotate() with a configured key or a validated raw value; it has no visible effect without backdrop-layer.
@mixin backdrop-hue-rotate($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|String | Required | A $backdrop-hue-rotate-values key (0, 90, 180, 270; unquoted and quoted numbers both match), an angle such as 45deg, calc() or var(); anything else raises an error |
Example 1
.overlay { @include backdrop-layer; @include backdrop-hue-rotate(90);}.overlay { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); --nu-backdrop-hue-rotate: hue-rotate(90deg);}Example 2
.overlay { @include apply(backdrop-layer, backdrop-hue-rotate(45deg));}.overlay { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); --nu-backdrop-hue-rotate: hue-rotate(45deg);}backdrop-invert mixinSets the --nu-backdrop-invert variable to invert() with a configured key or a validated raw value; it has no visible effect without backdrop-layer.
@mixin backdrop-invert($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|String | Required | A $backdrop-invert-values key (none, 25, 50, 75, 100; unquoted and quoted numbers both match), a percentage, calc() or var(); anything else raises an error |
Example 1
.overlay { @include backdrop-layer; @include backdrop-invert(100);}.overlay { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); --nu-backdrop-invert: invert(100%);}Example 2
.overlay { @include apply(backdrop-layer, backdrop-invert(10%));}.overlay { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); --nu-backdrop-invert: invert(10%);}backdrop-saturate mixinSets the --nu-backdrop-saturate variable to saturate() with a configured key or a validated raw value; it has no visible effect without backdrop-layer.
@mixin backdrop-saturate($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|String | Required | A $backdrop-saturate-values key (none, 50, 75, 125, 150, 200; unquoted and quoted numbers both match), a percentage, calc() or var(); anything else raises an error |
Example 1
.overlay { @include backdrop-layer; @include backdrop-saturate(150);}.overlay { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); --nu-backdrop-saturate: saturate(150%);}Example 2
.overlay { @include apply(backdrop-layer, backdrop-saturate(180%));}.overlay { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); --nu-backdrop-saturate: saturate(180%);}backdrop-sepia mixinSets the --nu-backdrop-sepia variable to sepia() with a configured key or a validated raw value; it has no visible effect without backdrop-layer.
@mixin backdrop-sepia($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|String | Required | A $backdrop-sepia-values key (none, 25, 50, 75, 100; unquoted and quoted numbers both match), a percentage, calc() or var(); anything else raises an error |
Example 1
.overlay { @include backdrop-layer; @include backdrop-sepia(50);}.overlay { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); --nu-backdrop-sepia: sepia(50%);}Example 2
.overlay { @include apply(backdrop-layer, backdrop-sepia(20%));}.overlay { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); --nu-backdrop-sepia: sepia(20%);}backdrop-frosted mixinApplies the frosted preset (blur(8px) saturate(90%) brightness(120%)) directly to backdrop-filter, so no backdrop-layer is needed.
@mixin backdrop-frostedExample
.panel { @include backdrop-frosted;}.panel { -webkit-backdrop-filter: blur(8px) saturate(90%) brightness(120%); backdrop-filter: blur(8px) saturate(90%) brightness(120%);}backdrop-glass mixinApplies the glass preset (blur(8px) saturate(120%) contrast(90%)) directly to backdrop-filter, so no backdrop-layer is needed.
@mixin backdrop-glassExample
.panel { @include backdrop-glass;}.panel { -webkit-backdrop-filter: blur(8px) saturate(120%) contrast(90%); backdrop-filter: blur(8px) saturate(120%) contrast(90%);}backdrop-dark-glass mixinApplies the dark glass preset (blur(8px) saturate(180%) brightness(70%) contrast(90%)) directly to backdrop-filter, so no backdrop-layer is needed.
@mixin backdrop-dark-glassExample
.panel { @include backdrop-dark-glass;}.panel { -webkit-backdrop-filter: blur(8px) saturate(180%) brightness(70%) contrast(90%); backdrop-filter: blur(8px) saturate(180%) brightness(70%) contrast(90%);}backdrop-crystal mixinApplies the crystal preset (blur(8px) saturate(150%)) directly to backdrop-filter, so no backdrop-layer is needed.
@mixin backdrop-crystalExample
.panel { @include backdrop-crystal;}.panel { -webkit-backdrop-filter: blur(8px) saturate(150%); backdrop-filter: blur(8px) saturate(150%);}backdrop-matte mixinApplies the matte preset (blur(20px) saturate(90%) brightness(90%)) directly to backdrop-filter, so no backdrop-layer is needed.
@mixin backdrop-matteExample
.panel { @include backdrop-matte;}.panel { -webkit-backdrop-filter: blur(20px) saturate(90%) brightness(90%); backdrop-filter: blur(20px) saturate(90%) brightness(90%);}backdrop-none mixinRemoves the backdrop filter and returns the --nu-backdrop-* variables to their identity values, so a later composed filter stays valid.
@mixin backdrop-noneExample
.panel { @include backdrop-none;}.panel { -webkit-backdrop-filter: none; backdrop-filter: none; --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0);}generate-backdrop-filter-utilities mixinEmits the backdrop utility classes (layer, filters, presets, none), with an @breakpoint suffix when a breakpoint is given.
@mixin generate-backdrop-filter-utilities($breakpoint: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$breakpoint | String|Null | null | Breakpoint name used as the class suffix; place the call inside the matching media query |
Classes such as .backdrop-layer@md, .backdrop-blur-md@md and .backdrop-frosted@mdExample
@media (min-width: 768px) { @include generate-backdrop-filter-utilities(md);}@media (min-width: 768px) { :where(.backdrop-layer\@md) { --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); } .backdrop-layer\@md { -webkit-backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); backdrop-filter: var(--nu-backdrop-blur) var(--nu-backdrop-brightness) var(--nu-backdrop-contrast) var(--nu-backdrop-grayscale) var(--nu-backdrop-hue-rotate) var(--nu-backdrop-invert) var(--nu-backdrop-saturate) var(--nu-backdrop-sepia); } .backdrop-none\@md { -webkit-backdrop-filter: none; backdrop-filter: none; --nu-backdrop-blur: blur(0); --nu-backdrop-brightness: brightness(100%); --nu-backdrop-contrast: contrast(100%); --nu-backdrop-grayscale: grayscale(0); --nu-backdrop-hue-rotate: hue-rotate(0deg); --nu-backdrop-invert: invert(0); --nu-backdrop-saturate: saturate(100%); --nu-backdrop-sepia: sepia(0); } .backdrop-blur-none\@md { --nu-backdrop-blur: blur(0); } .backdrop-blur-sm\@md { --nu-backdrop-blur: blur(2px); } .backdrop-blur-md\@md { --nu-backdrop-blur: blur(4px); } .backdrop-blur-lg\@md { --nu-backdrop-blur: blur(8px); } .backdrop-blur-xl\@md { --nu-backdrop-blur: blur(16px); } .backdrop-blur-2xl\@md { --nu-backdrop-blur: blur(32px); } .backdrop-brightness-none\@md { --nu-backdrop-brightness: brightness(100%); } .backdrop-brightness-75\@md { --nu-backdrop-brightness: brightness(75%); } .backdrop-brightness-90\@md { --nu-backdrop-brightness: brightness(90%); } .backdrop-brightness-110\@md { --nu-backdrop-brightness: brightness(110%); } .backdrop-brightness-125\@md { --nu-backdrop-brightness: brightness(125%); } .backdrop-brightness-150\@md { --nu-backdrop-brightness: brightness(150%); } .backdrop-contrast-none\@md { --nu-backdrop-contrast: contrast(100%); } .backdrop-contrast-75\@md { --nu-backdrop-contrast: contrast(75%); } .backdrop-contrast-90\@md { --nu-backdrop-contrast: contrast(90%); } .backdrop-contrast-110\@md { --nu-backdrop-contrast: contrast(110%); } .backdrop-contrast-125\@md { --nu-backdrop-contrast: contrast(125%); } .backdrop-contrast-150\@md { --nu-backdrop-contrast: contrast(150%); } .backdrop-grayscale-none\@md { --nu-backdrop-grayscale: grayscale(0); } .backdrop-grayscale-25\@md { --nu-backdrop-grayscale: grayscale(25%); } .backdrop-grayscale-50\@md { --nu-backdrop-grayscale: grayscale(50%); } .backdrop-grayscale-75\@md { --nu-backdrop-grayscale: grayscale(75%); } .backdrop-grayscale-100\@md { --nu-backdrop-grayscale: grayscale(100%); } .backdrop-saturate-none\@md { --nu-backdrop-saturate: saturate(100%); } .backdrop-saturate-50\@md { --nu-backdrop-saturate: saturate(50%); } .backdrop-saturate-75\@md { --nu-backdrop-saturate: saturate(75%); } .backdrop-saturate-125\@md { --nu-backdrop-saturate: saturate(125%); } .backdrop-saturate-150\@md { --nu-backdrop-saturate: saturate(150%); } .backdrop-saturate-200\@md { --nu-backdrop-saturate: saturate(200%); } .backdrop-sepia-none\@md { --nu-backdrop-sepia: sepia(0); } .backdrop-sepia-25\@md { --nu-backdrop-sepia: sepia(25%); } .backdrop-sepia-50\@md { --nu-backdrop-sepia: sepia(50%); } .backdrop-sepia-75\@md { --nu-backdrop-sepia: sepia(75%); } .backdrop-sepia-100\@md { --nu-backdrop-sepia: sepia(100%); } .backdrop-hue-rotate-0\@md { --nu-backdrop-hue-rotate: hue-rotate(0deg); } .backdrop-hue-rotate-90\@md { --nu-backdrop-hue-rotate: hue-rotate(90deg); } .backdrop-hue-rotate-180\@md { --nu-backdrop-hue-rotate: hue-rotate(180deg); } .backdrop-hue-rotate-270\@md { --nu-backdrop-hue-rotate: hue-rotate(270deg); } .backdrop-invert-none\@md { --nu-backdrop-invert: invert(0); } .backdrop-invert-25\@md { --nu-backdrop-invert: invert(25%); } .backdrop-invert-50\@md { --nu-backdrop-invert: invert(50%); } .backdrop-invert-75\@md { --nu-backdrop-invert: invert(75%); } .backdrop-invert-100\@md { --nu-backdrop-invert: invert(100%); } .backdrop-frosted\@md { -webkit-backdrop-filter: blur(8px) saturate(90%) brightness(120%); backdrop-filter: blur(8px) saturate(90%) brightness(120%); } .backdrop-glass\@md { -webkit-backdrop-filter: blur(8px) saturate(120%) contrast(90%); backdrop-filter: blur(8px) saturate(120%) contrast(90%); } .backdrop-dark-glass\@md { -webkit-backdrop-filter: blur(8px) saturate(180%) brightness(70%) contrast(90%); backdrop-filter: blur(8px) saturate(180%) brightness(70%) contrast(90%); } .backdrop-crystal\@md { -webkit-backdrop-filter: blur(8px) saturate(150%); backdrop-filter: blur(8px) saturate(150%); } .backdrop-matte\@md { -webkit-backdrop-filter: blur(20px) saturate(90%) brightness(90%); backdrop-filter: blur(20px) saturate(90%) brightness(90%); }}border border-top border-right border-bottom border-left border-start border-end rounded rounded-t rounded-r rounded-b rounded-l rounded-tl rounded-tr rounded-br rounded-bl rounded-s rounded-e rounded-ss rounded-se rounded-es rounded-ee border-style border-color border-all pill
border mixinDraws a border on all sides with a width key, a style and a colour that defaults to the border-regular token.
@mixin border($val, $style: solid, $color: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length | Required | A $border-widths key (0, 1, 2, 4, 8) giving var(--nu-border-width-*), or a length such as 3px |
$style | String | solid | solid, dashed, dotted, double, none, a CSS-wide keyword or var(); written to --nu-border-style |
$color | String|Color|Null | null | A role, palette name, theme word (regular, strong, control, control-hover, focus), colour value or var(); resolved like border-color() |
border-width, border-style: var(--nu-border-style), border-color and --nu-border-style; a zero width emits border-width onlyExample 1
.card { @include border(1); // var(--nu-border-width-1), solid, var(--nu-border-regular)}.card { border-width: var(--nu-border-width-1); border-style: var(--nu-border-style); border-color: var(--nu-border-regular); --nu-border-style: solid;}Example 2
.alert { @include border(2, dashed, danger);}.alert { border-width: var(--nu-border-width-2); border-style: var(--nu-border-style); border-color: var(--nu-danger); --nu-border-style: dashed;}Example 3
.input { @include apply(border(1, solid, control), rounded(md));}.input { border-width: var(--nu-border-width-1); border-style: var(--nu-border-style); border-color: var(--nu-border-control); --nu-border-style: solid; border-radius: var(--nu-radius-md);}Note. A unitless width that is not a key, such as 3, raises an error; an unknown style raises an error.
border-top mixinDraws a border on the top side in the border-regular colour unless a colour is given.
@mixin border-top($val, $style: solid, $color: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length | Required | A $border-widths key (0, 1, 2, 4, 8) giving var(--nu-border-width-*), or a length such as 3px |
$style | String | solid | solid, dashed, dotted, double, none, a CSS-wide keyword or var(); written to --nu-border-style |
$color | String|Color|Null | null | A role, palette name, theme word, colour value or var(), resolved like border-color(); null gives the border-regular token |
Example 1
.item { @include border-top(1);}.item { border-top-width: var(--nu-border-width-1); border-top-style: var(--nu-border-style); border-top-color: var(--nu-border-regular); --nu-border-style: solid;}Example 2
.divider { @include border-top(2, dashed, brand);}.divider { border-top-width: var(--nu-border-width-2); border-top-style: var(--nu-border-style); border-top-color: var(--nu-brand); --nu-border-style: dashed;}border-right mixinDraws a border on the right side (physical) in the border-regular colour unless a colour is given.
@mixin border-right($val, $style: solid, $color: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length | Required | A $border-widths key (0, 1, 2, 4, 8) giving var(--nu-border-width-*), or a length such as 3px |
$style | String | solid | solid, dashed, dotted, double, none, a CSS-wide keyword or var(); written to --nu-border-style |
$color | String|Color|Null | null | A role, palette name, theme word, colour value or var(), resolved like border-color(); null gives the border-regular token |
Example 1
.item { @include border-right(1);}.item { border-right-width: var(--nu-border-width-1); border-right-style: var(--nu-border-style); border-right-color: var(--nu-border-regular); --nu-border-style: solid;}Example 2
.divider { @include border-right(2, dashed, brand);}.divider { border-right-width: var(--nu-border-width-2); border-right-style: var(--nu-border-style); border-right-color: var(--nu-brand); --nu-border-style: dashed;}border-bottom mixinDraws a border on the bottom side in the border-regular colour unless a colour is given.
@mixin border-bottom($val, $style: solid, $color: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length | Required | A $border-widths key (0, 1, 2, 4, 8) giving var(--nu-border-width-*), or a length such as 3px |
$style | String | solid | solid, dashed, dotted, double, none, a CSS-wide keyword or var(); written to --nu-border-style |
$color | String|Color|Null | null | A role, palette name, theme word, colour value or var(), resolved like border-color(); null gives the border-regular token |
Example 1
.item { @include border-bottom(1);}.item { border-bottom-width: var(--nu-border-width-1); border-bottom-style: var(--nu-border-style); border-bottom-color: var(--nu-border-regular); --nu-border-style: solid;}Example 2
.divider { @include border-bottom(2, dashed, brand);}.divider { border-bottom-width: var(--nu-border-width-2); border-bottom-style: var(--nu-border-style); border-bottom-color: var(--nu-brand); --nu-border-style: dashed;}border-left mixinDraws a border on the left side (physical) in the border-regular colour unless a colour is given.
@mixin border-left($val, $style: solid, $color: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length | Required | A $border-widths key (0, 1, 2, 4, 8) giving var(--nu-border-width-*), or a length such as 3px |
$style | String | solid | solid, dashed, dotted, double, none, a CSS-wide keyword or var(); written to --nu-border-style |
$color | String|Color|Null | null | A role, palette name, theme word, colour value or var(), resolved like border-color(); null gives the border-regular token |
Example 1
.item { @include border-left(1);}.item { border-left-width: var(--nu-border-width-1); border-left-style: var(--nu-border-style); border-left-color: var(--nu-border-regular); --nu-border-style: solid;}Example 2
.divider { @include border-left(2, dashed, brand);}.divider { border-left-width: var(--nu-border-width-2); border-left-style: var(--nu-border-style); border-left-color: var(--nu-brand); --nu-border-style: dashed;}border-start mixinDraws a border on the inline start side (left in LTR, right in RTL) in the border-regular colour unless a colour is given.
@mixin border-start($val, $style: solid, $color: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length | Required | A $border-widths key (0, 1, 2, 4, 8) giving var(--nu-border-width-*), or a length such as 3px |
$style | String | solid | solid, dashed, dotted, double, none, a CSS-wide keyword or var(); written to --nu-border-style |
$color | String|Color|Null | null | A role, palette name, theme word, colour value or var(), resolved like border-color(); null gives the border-regular token |
Example 1
.item { @include border-start(1);}.item { border-inline-start-width: var(--nu-border-width-1); border-inline-start-style: var(--nu-border-style); border-inline-start-color: var(--nu-border-regular); --nu-border-style: solid;}Example 2
.divider { @include border-start(2, dashed, brand);}.divider { border-inline-start-width: var(--nu-border-width-2); border-inline-start-style: var(--nu-border-style); border-inline-start-color: var(--nu-brand); --nu-border-style: dashed;}border-end mixinDraws a border on the inline end side (right in LTR, left in RTL) in the border-regular colour unless a colour is given.
@mixin border-end($val, $style: solid, $color: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length | Required | A $border-widths key (0, 1, 2, 4, 8) giving var(--nu-border-width-*), or a length such as 3px |
$style | String | solid | solid, dashed, dotted, double, none, a CSS-wide keyword or var(); written to --nu-border-style |
$color | String|Color|Null | null | A role, palette name, theme word, colour value or var(), resolved like border-color(); null gives the border-regular token |
Example 1
.item { @include border-end(1);}.item { border-inline-end-width: var(--nu-border-width-1); border-inline-end-style: var(--nu-border-style); border-inline-end-color: var(--nu-border-regular); --nu-border-style: solid;}Example 2
.divider { @include border-end(2, dashed, brand);}.divider { border-inline-end-width: var(--nu-border-width-2); border-inline-end-style: var(--nu-border-style); border-inline-end-color: var(--nu-brand); --nu-border-style: dashed;}rounded mixinRounds all corners with a $border-radii key (md when omitted) or a raw length.
@mixin rounded($val: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | String|Length|Null | null | A $border-radii key (xs, sm, md, lg, xl, 2xl, full, none), a length, calc() or var() |
Example 1
.card { @include rounded; // border-radius: var(--nu-radius-md)}.card { border-radius: var(--nu-radius-md);}Example 2
.avatar { @include apply(rounded(full), border(2, solid, brand));}.avatar { border-radius: var(--nu-radius-full); border-width: var(--nu-border-width-2); border-style: var(--nu-border-style); border-color: var(--nu-brand); --nu-border-style: solid;}Note. A unitless number that is not a key, such as 4, raises an error.
rounded-t mixinRounds the top left and top right corners with a $border-radii key (md when omitted) or a raw length.
@mixin rounded-t($val: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | String|Length|Null | null | A $border-radii key (xs, sm, md, lg, xl, 2xl, full, none), a length, calc() or var() |
Example
.tab { @include rounded-t(lg);}.tab { border-top-left-radius: var(--nu-radius-lg); border-top-right-radius: var(--nu-radius-lg);}rounded-r mixinRounds the top right and bottom right corners (physical) with a $border-radii key (md when omitted) or a raw length.
@mixin rounded-r($val: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | String|Length|Null | null | A $border-radii key (xs, sm, md, lg, xl, 2xl, full, none), a length, calc() or var() |
Example
.tab { @include rounded-r(lg);}.tab { border-top-right-radius: var(--nu-radius-lg); border-bottom-right-radius: var(--nu-radius-lg);}rounded-b mixinRounds the bottom left and bottom right corners with a $border-radii key (md when omitted) or a raw length.
@mixin rounded-b($val: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | String|Length|Null | null | A $border-radii key (xs, sm, md, lg, xl, 2xl, full, none), a length, calc() or var() |
Example
.tab { @include rounded-b(lg);}.tab { border-bottom-left-radius: var(--nu-radius-lg); border-bottom-right-radius: var(--nu-radius-lg);}rounded-l mixinRounds the top left and bottom left corners (physical) with a $border-radii key (md when omitted) or a raw length.
@mixin rounded-l($val: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | String|Length|Null | null | A $border-radii key (xs, sm, md, lg, xl, 2xl, full, none), a length, calc() or var() |
Example
.tab { @include rounded-l(lg);}.tab { border-top-left-radius: var(--nu-radius-lg); border-bottom-left-radius: var(--nu-radius-lg);}rounded-tl mixinRounds the top left corner with a $border-radii key (md when omitted) or a raw length.
@mixin rounded-tl($val: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | String|Length|Null | null | A $border-radii key (xs, sm, md, lg, xl, 2xl, full, none), a length, calc() or var() |
Example
.tab { @include rounded-tl(lg);}.tab { border-top-left-radius: var(--nu-radius-lg);}rounded-tr mixinRounds the top right corner with a $border-radii key (md when omitted) or a raw length.
@mixin rounded-tr($val: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | String|Length|Null | null | A $border-radii key (xs, sm, md, lg, xl, 2xl, full, none), a length, calc() or var() |
Example
.tab { @include rounded-tr(lg);}.tab { border-top-right-radius: var(--nu-radius-lg);}rounded-br mixinRounds the bottom right corner with a $border-radii key (md when omitted) or a raw length.
@mixin rounded-br($val: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | String|Length|Null | null | A $border-radii key (xs, sm, md, lg, xl, 2xl, full, none), a length, calc() or var() |
Example
.tab { @include rounded-br(lg);}.tab { border-bottom-right-radius: var(--nu-radius-lg);}rounded-bl mixinRounds the bottom left corner with a $border-radii key (md when omitted) or a raw length.
@mixin rounded-bl($val: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | String|Length|Null | null | A $border-radii key (xs, sm, md, lg, xl, 2xl, full, none), a length, calc() or var() |
Example
.tab { @include rounded-bl(lg);}.tab { border-bottom-left-radius: var(--nu-radius-lg);}rounded-s mixinRounds both inline start corners (border-start-start-radius and border-end-start-radius) with a $border-radii key (md when omitted) or a raw length.
@mixin rounded-s($val: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | String|Length|Null | null | A $border-radii key (xs, sm, md, lg, xl, 2xl, full, none), a length, calc() or var() |
Example
.tab { @include rounded-s(lg);}.tab { border-start-start-radius: var(--nu-radius-lg); border-end-start-radius: var(--nu-radius-lg);}rounded-e mixinRounds both inline end corners (border-start-end-radius and border-end-end-radius) with a $border-radii key (md when omitted) or a raw length.
@mixin rounded-e($val: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | String|Length|Null | null | A $border-radii key (xs, sm, md, lg, xl, 2xl, full, none), a length, calc() or var() |
Example
.tab { @include rounded-e(lg);}.tab { border-start-end-radius: var(--nu-radius-lg); border-end-end-radius: var(--nu-radius-lg);}rounded-ss mixinRounds the block start, inline start corner (border-start-start-radius) with a $border-radii key (md when omitted) or a raw length.
@mixin rounded-ss($val: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | String|Length|Null | null | A $border-radii key (xs, sm, md, lg, xl, 2xl, full, none), a length, calc() or var() |
Example
.tab { @include rounded-ss(lg);}.tab { border-start-start-radius: var(--nu-radius-lg);}rounded-se mixinRounds the block start, inline end corner (border-start-end-radius) with a $border-radii key (md when omitted) or a raw length.
@mixin rounded-se($val: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | String|Length|Null | null | A $border-radii key (xs, sm, md, lg, xl, 2xl, full, none), a length, calc() or var() |
Example
.tab { @include rounded-se(lg);}.tab { border-start-end-radius: var(--nu-radius-lg);}rounded-es mixinRounds the block end, inline start corner (border-end-start-radius) with a $border-radii key (md when omitted) or a raw length.
@mixin rounded-es($val: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | String|Length|Null | null | A $border-radii key (xs, sm, md, lg, xl, 2xl, full, none), a length, calc() or var() |
Example
.tab { @include rounded-es(lg);}.tab { border-end-start-radius: var(--nu-radius-lg);}rounded-ee mixinRounds the block end, inline end corner (border-end-end-radius) with a $border-radii key (md when omitted) or a raw length.
@mixin rounded-ee($val: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | String|Length|Null | null | A $border-radii key (xs, sm, md, lg, xl, 2xl, full, none), a length, calc() or var() |
Example
.tab { @include rounded-ee(lg);}.tab { border-end-end-radius: var(--nu-radius-lg);}border-style mixinSets --nu-border-style, which changes the style of borders drawn by border(), border-top() and the other side mixins on the same element.
@mixin border-style($style)| Parameter | Type | Default | Description |
|---|---|---|---|
$style | String | Required | solid, dashed, dotted, double, none, a CSS-wide keyword or var() |
--nu-border-style only; it draws nothing without a border mixin or classExample
.dropzone { @include border(2); @include border-style(dashed);}.dropzone { border-width: var(--nu-border-width-2); border-style: var(--nu-border-style); border-color: var(--nu-border-regular); --nu-border-style: solid; --nu-border-style: dashed;}Note. Include it after the border mixin, which also writes --nu-border-style; an unknown style raises an error.
border-color mixinSets border-color from a role, palette name, theme word or colour, emitting the matching var(--nu-*) token.
@mixin border-color($color, $shade: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$color | String|Color | Required | A role (brand, danger), role state (danger-border, brand-hover), palette name (red), theme word (regular, strong, control, control-hover, focus), colour value or var() |
$shade | Number|Null | null | A shade stop (50, 100 to 900, 950) for a role or palette name |
Example 1
.card { @include border-color(regular); // var(--nu-border-regular)}.card { border-color: var(--nu-border-regular);}Example 2
.alert { @include apply(border(1), border-color(danger-border));}.alert { border-width: var(--nu-border-width-1); border-style: var(--nu-border-style); border-color: var(--nu-border-regular); --nu-border-style: solid; border-color: var(--nu-danger-border);}Example 3
.tag { @include border-color(purple, 300); // var(--nu-purple-300)}.tag { border-color: var(--nu-purple-300);}Note. Roles give their fill {role} and palette names give {hue}-500; a shade outside 50 to 950 raises an error, and a raw colour with a shade is shaded at compile time.
border-all mixinDraws a border on all sides with a width, a style and a colour, all required; the same output as border() with every argument given.
@mixin border-all($width, $style, $color)| Parameter | Type | Default | Description |
|---|---|---|---|
$width | Number|Length | Required | A $border-widths key (0, 1, 2, 4, 8) giving var(--nu-border-width-*), or a length |
$style | String | Required | solid, dashed, dotted, double, none, a CSS-wide keyword or var(); written to --nu-border-style |
$color | String|Color | Required | A role, palette name, theme word, colour value or var(); resolved like border-color() |
Example
.panel { @include border-all(1, solid, strong);}.panel { border-width: var(--nu-border-width-1); border-style: var(--nu-border-style); border-color: var(--nu-border-strong); --nu-border-style: solid;}Note. The style goes through --nu-border-style, so border-style() and .border-{style} classes change it, as with border().
pill mixinRounds all corners fully with the full radius token, var(--nu-radius-full).
@mixin pillExample
.badge { @include apply(pill, px(3));}.badge { border-radius: var(--nu-radius-full); padding-inline: var(--nu-space-3);}adaptive-contrast bg text-color text-on-color gradient
adaptive-contrast mixinSets background-color and the higher contrast text colour, both computed at compile time; under prefers-contrast: more the background moves away from the text colour (darker under light text, lighter under dark text) for a higher ratio.
@mixin adaptive-contrast($color)| Parameter | Type | Default | Description |
|---|---|---|---|
$color | String|Color | Required | A role or palette name (resolved with get-color()) or a colour value |
Resolved colour values, not var(--nu-*) tokens, so the result does not follow themesExample 1
.banner { @include adaptive-contrast(brand);}.banner { background-color: #007bff; color: #1a1a1a;}@media (prefers-contrast: more) { .banner { background-color: rgb(20%, 58.5882352941%, 100%); color: #1a1a1a; }}Example 2
.badge { @include adaptive-contrast(#1e293b);}.badge { background-color: #1e293b; color: #f1f1f1;}@media (prefers-contrast: more) { .badge { background-color: rgb(5.0231328486%, 6.8649482265%, 9.8788279357%); color: #f1f1f1; }}bg mixinSets background-color from a role, palette name, theme word or colour, emitting the matching var(--nu-*) token.
@mixin bg($color, $shade: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$color | String|Color | Required | A role (brand, danger), role state (danger-subtle, brand-hover), palette name (red), theme word (base, surface, alternate, raised, hover, selected, disabled), colour value or var() |
$shade | Number|Null | null | A shade stop (50, 100 to 900, 950) for a role or palette name |
Example 1
.card { @include bg(surface); // var(--nu-bg-surface)}.card { background-color: var(--nu-bg-surface);}Example 2
.alert { @include apply(bg(danger-subtle), text-color(danger), border(1, solid, danger-border));}.alert { background-color: var(--nu-danger-subtle); color: var(--nu-text-danger); border-width: var(--nu-border-width-1); border-style: var(--nu-border-style); border-color: var(--nu-danger-border); --nu-border-style: solid;}Example 3
.chip { @include bg(brand, 100); // var(--nu-brand-100)}.chip { background-color: var(--nu-brand-100);}Note. bg(brand) gives var(--nu-brand) and bg(red) the fixed var(--nu-red-500); a shade outside 50 to 950 raises an error, and a raw colour with a shade is shaded at compile time.
text-color mixinSets color from a role, palette name, theme word or colour, emitting the matching var(--nu-text-*) token.
@mixin text-color($color-name, $shade: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$color-name | String|Color | Required | A role (brand, danger), palette name (red), theme word (regular, muted, subtle, inverted, link, link-hover), colour value or var() |
$shade | Number|Null | null | A shade stop (50, 100 to 900, 950) for a role or palette name, giving the fixed palette token |
Example 1
.caption { @include text-color(muted); // var(--nu-text-muted)}.caption { color: var(--nu-text-muted);}Example 2
.error-message { @include apply(text-color(danger), font-size(sm));}.error-message { color: var(--nu-text-danger); font-size: var(--nu-font-size-sm);}Note. text-color(brand) gives var(--nu-text-brand) and text-color(red) the theme aware var(--nu-text-red); with a shade the token is var(--nu-{name}-{stop}).
text-on-color mixinSets the text colour for content placed on a filled colour: a role gives its var(--nu-text-on-*) token, anything else the higher contrast text colour computed at compile time.
@mixin text-on-color($color-name, $shade: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$color-name | String|Color | Required | A role (brand, danger), palette name (purple) or colour value |
$shade | Number|Null | null | Shade stop of the fill (50, 100 to 900, 950); defaults to 500 when the colour is not a role |
Example 1
.button { @include apply(bg(brand), text-on-color(brand)); // color: var(--nu-text-on-brand)}.button { background-color: var(--nu-brand); color: var(--nu-text-on-brand);}Example 2
.tag { @include bg(purple, 700); @include text-on-color(purple, 700);}.tag { background-color: var(--nu-purple-700); color: #f1f1f1;}Note. A role with a shade, a palette name or a colour value gives a fixed colour that does not follow themes.
gradient mixinSets background-image to a linear-gradient with the given direction and colour stops; colour names resolve like bg() (roles, palette names, theme words), other colours and positions are written as passed.
@mixin gradient($direction, $colors...)| Parameter | Type | Default | Description |
|---|---|---|---|
$direction | String|Number | Required | A direction such as to right or an angle such as 135deg |
$colors | Any | Required | Colour stops: a role (brand), palette name (red), theme word (surface), colour value or var(), each optionally followed by a position (brand 20%) |
Example 1
.hero { @include gradient(to right, brand, purple); // linear-gradient(to right, var(--nu-brand), var(--nu-purple-500))}.hero { background-image: linear-gradient(to right, var(--nu-brand), var(--nu-purple-500));}Example 2
.fade { @include gradient(180deg, transparent, base 80%);}.fade { background-image: linear-gradient(180deg, var(--nu-transparent), var(--nu-bg-base) 80%);}Note. An unknown colour word raises the same error as bg().
cursor mixinSets the cursor property to a CSS cursor keyword, or to a value holding a function such as url() or var(); any other word raises an error.
@mixin cursor($cursor-value)| Parameter | Type | Default | Description |
|---|---|---|---|
$cursor-value | String|List | Required | A cursor keyword (pointer, not-allowed, grab), or a value with url(), image-set() or var(), such as url(hand.svg), pointer |
Example
.card-link { @include cursor(pointer);}.card-link { cursor: pointer;}hide block inline inline-block show grid inline-grid flex inline-flex table table-row table-cell visible invisible collapse contents overflow-hidden overflow-visible overflow-scroll overflow-auto overflow-x-hidden overflow-y-hidden overflow-x-scroll overflow-y-scroll overflow-x-auto overflow-y-auto truncate overflow-label truncate-lines
hide mixinSets display to none.
@mixin hideExample
.modal-closed { @include hide;}.modal-closed { display: none;}block mixinSets display to block.
@mixin blockExample
.thumbnail { @include block;}.thumbnail { display: block;}inline mixinSets display to inline.
@mixin inlineExample
.tag-label { @include inline;}.tag-label { display: inline;}inline-block mixinSets display to inline-block.
@mixin inline-blockExample
.badge { @include inline-block;}.badge { display: inline-block;}show mixinSets display to revert, restoring the element's natural display (block for a div, table for a table) after .hide or a responsive hide.
@mixin showExample
.toolbar-label { @include show;}.toolbar-label { display: revert;}grid mixinSets display to grid, establishing a grid container.
@mixin gridExample
.gallery { @include grid;}.gallery { display: grid;}inline-grid mixinSets display to inline-grid, establishing an inline grid container.
@mixin inline-gridExample
.icon-set { @include inline-grid;}.icon-set { display: inline-grid;}flex mixinSets display to flex, establishing a flex container.
@mixin flexExample
.toolbar { @include flex;}.toolbar { display: flex;}inline-flex mixinSets display to inline-flex, establishing an inline flex container.
@mixin inline-flexExample
.chip { @include inline-flex;}.chip { display: inline-flex;}table mixinSets display to table.
@mixin tableExample
.data-grid { @include table;}.data-grid { display: table;}table-row mixinSets display to table-row.
@mixin table-rowExample
.data-grid-row { @include table-row;}.data-grid-row { display: table-row;}table-cell mixinSets display to table-cell.
@mixin table-cellExample
.data-grid-cell { @include table-cell;}.data-grid-cell { display: table-cell;}visible mixinSets visibility to visible.
@mixin visibleExample
.row-actions { @include visible;}.row-actions { visibility: visible;}invisible mixinSets visibility to hidden, keeping the element in the layout.
@mixin invisibleExample
.row-actions { @include invisible;}.row-actions { visibility: hidden;}collapse mixinSets visibility to collapse, which removes table rows and columns without changing table layout.
@mixin collapseExample
.table-row-hidden { @include collapse;}.table-row-hidden { visibility: collapse;}contents mixinSets display to contents, so the element box disappears and its children join the parent layout.
@mixin contentsExample
.field-group { @include contents;}.field-group { display: contents;}overflow-hidden mixinSets overflow to hidden on both axes.
@mixin overflow-hiddenExample
.panel { @include overflow-hidden;}.panel { overflow: hidden;}overflow-visible mixinSets overflow to visible on both axes.
@mixin overflow-visibleExample
.panel { @include overflow-visible;}.panel { overflow: visible;}overflow-scroll mixinSets overflow to scroll on both axes.
@mixin overflow-scrollExample
.panel { @include overflow-scroll;}.panel { overflow: scroll;}overflow-auto mixinSets overflow to auto on both axes.
@mixin overflow-autoExample
.panel { @include overflow-auto;}.panel { overflow: auto;}overflow-x-hidden mixinSets overflow-x to hidden (horizontal axis).
@mixin overflow-x-hiddenExample
.panel { @include overflow-x-hidden;}.panel { overflow-x: hidden;}overflow-y-hidden mixinSets overflow-y to hidden (vertical axis).
@mixin overflow-y-hiddenExample
.panel { @include overflow-y-hidden;}.panel { overflow-y: hidden;}overflow-x-scroll mixinSets overflow-x to scroll (horizontal axis).
@mixin overflow-x-scrollExample
.panel { @include overflow-x-scroll;}.panel { overflow-x: scroll;}overflow-y-scroll mixinSets overflow-y to scroll (vertical axis).
@mixin overflow-y-scrollExample
.panel { @include overflow-y-scroll;}.panel { overflow-y: scroll;}overflow-x-auto mixinSets overflow-x to auto (horizontal axis).
@mixin overflow-x-autoExample
.panel { @include overflow-x-auto;}.panel { overflow-x: auto;}overflow-y-auto mixinSets overflow-y to auto (vertical axis).
@mixin overflow-y-autoExample
.panel { @include overflow-y-auto;}.panel { overflow-y: auto;}truncate mixinTruncates text to one line with an ellipsis, or to a number of lines like truncate-lines() (truncate(2) matches the .truncate-2 class).
@mixin truncate($lines: 1)| Parameter | Type | Default | Description |
|---|---|---|---|
$lines | Number|String | 1 | Number of visible lines: 1, or a whole number above 1, calc() or var() for a multi-line clamp |
Example 1
.file-name { @include truncate;}.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}Example 2
.card-summary { @include truncate(2); // the same as truncate-lines(2)}.card-summary { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis;}overflow-label mixinTruncates a flex or grid child to one line; min-width 0 lets it shrink below its content width.
@mixin overflow-labelExample
.nav-item-label { @include overflow-label;}.nav-item-label { white-space: nowrap; word-break: break-all; text-overflow: ellipsis; overflow: hidden; min-width: 0;}truncate-lines mixinClamps text to a number of lines with an ellipsis using -webkit-line-clamp.
@mixin truncate-lines($lines: 2)| Parameter | Type | Default | Description |
|---|---|---|---|
$lines | Number|String | 2 | Number of visible lines: a whole number of 1 or more, calc() or var(); anything else raises an error |
Example
.card-summary { @include truncate-lines(3);}.card-summary { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis;}Controls element transparency with customizable opacity values and interactive states
opacity mixinSets opacity from a $opacities key, emitted as var(--nu-opacity-*) as in .opacity-50, or passes a percentage, calc(), var() or CSS-wide keyword through; a bare 0.5 raises an error.
@mixin opacity($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Percentage|String | Required | $opacities key (0, 5, 10 ... 100), percentage, calc(), var() or CSS-wide keyword |
Example
.badge-muted { @include opacity(50); // opacity: var(--nu-opacity-50), 0.5 by default}.ghost { @include apply(opacity(75) hover);}.badge-muted { opacity: var(--nu-opacity-50);}
.ghost:hover { opacity: var(--nu-opacity-75);}Controls element positioning and placement within the document flow
static relative absolute fixed sticky top right bottom left inset-start inset-end inset inset-x inset-y inset-auto inset-x-auto inset-y-auto absolute-center
static mixinSets position to static, the default document flow.
@mixin staticExample
.element { @include static;}.element { position: static;}relative mixinSets position to relative, creating a positioning context for absolute children.
@mixin relativeExample
.container { @include relative;}.container { position: relative;}absolute mixinSets position to absolute, removing the element from the normal document flow.
@mixin absoluteExample
.popup { @include absolute; @include top(0); @include left(0);}.popup { position: absolute; top: var(--nu-space-0); left: var(--nu-space-0);}fixed mixinSets position to fixed, placing the element relative to the viewport.
@mixin fixedExample
.banner { @include fixed; @include top(0); @include inset-x(0);}.banner { position: fixed; top: var(--nu-space-0); left: var(--nu-space-0); right: var(--nu-space-0);}sticky mixinSets position to sticky with top 0 and z-index 999, so the element stays in view while scrolling.
@mixin stickyposition: sticky; z-index: 999; top: 0Example
.nav { @include sticky;}.nav { position: sticky; z-index: 999; top: 0;}top mixinSets the physical top offset from the spacing scale or a raw value.
@mixin top($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | Spacing key (4), negative key (-4), fraction key (25p, -25p; 33p gives 33.333%), auto, or a raw length, percentage, calc() or var() |
Example
.toast { @include absolute; @include top(4); // top: var(--nu-space-4)}.toast { position: absolute; top: var(--nu-space-4);}right mixinSets the physical right offset from the spacing scale or a raw value.
@mixin right($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | Spacing key (4), negative key (-4), fraction key (25p, -25p; 33p gives 33.333%), auto, or a raw length, percentage, calc() or var() |
Example
.badge { @include absolute; @include right(-2); // right: calc(-1 * var(--nu-space-2))}.badge { position: absolute; right: calc(-1 * var(--nu-space-2));}bottom mixinSets the physical bottom offset from the spacing scale or a raw value.
@mixin bottom($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | Spacing key (4), negative key (-4), fraction key (25p, -25p; 33p gives 33.333%), auto, or a raw length, percentage, calc() or var() |
Example
.footer { @include fixed; @include bottom(0);}.footer { position: fixed; bottom: var(--nu-space-0);}left mixinSets the physical left offset from the spacing scale or a raw value.
@mixin left($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | Spacing key (4), negative key (-4), fraction key (25p, -25p; 33p gives 33.333%), auto, or a raw length, percentage, calc() or var() |
Example
.sidebar { @include fixed; @include left(50%);}.sidebar { position: fixed; left: 50%;}inset-start mixinSets inset-inline-start, which is the left offset in LTR and the right offset in RTL.
@mixin inset-start($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | Spacing key (4), negative key (-4), fraction key (25p, -25p; 33p gives 33.333%), auto, or a raw length, percentage, calc() or var() |
Example
.close-button { @include absolute; @include inset-start(2); // inset-inline-start: var(--nu-space-2)}.close-button { position: absolute; inset-inline-start: var(--nu-space-2);}inset-end mixinSets inset-inline-end, which is the right offset in LTR and the left offset in RTL.
@mixin inset-end($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | Spacing key (4), negative key (-4), fraction key (25p, -25p; 33p gives 33.333%), auto, or a raw length, percentage, calc() or var() |
Example
.close-button { @include absolute; @include top(2); @include inset-end(2); // inset-inline-end: var(--nu-space-2)}.close-button { position: absolute; top: var(--nu-space-2); inset-inline-end: var(--nu-space-2);}inset mixinSets the inset shorthand (top, right, bottom and left) to one value.
@mixin inset($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|String | Required | Spacing key (4), negative key (-4), fraction key (25p, -25p; 33p gives 33.333%), auto, or a raw length, percentage, calc() or var() |
Example
.overlay { @include absolute; @include inset(0); // inset: var(--nu-space-0)}.overlay { position: absolute; inset: var(--nu-space-0);}inset-x mixinSets the physical left and right offsets to one value.
@mixin inset-x($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|String | Required | Spacing key (4), negative key (-4), fraction key (25p, -25p; 33p gives 33.333%), auto, or a raw length, percentage, calc() or var() |
Example
.drawer-footer { @include absolute; @include bottom(0); @include inset-x(4);}.drawer-footer { position: absolute; bottom: var(--nu-space-0); left: var(--nu-space-4); right: var(--nu-space-4);}inset-y mixinSets the top and bottom offsets to one value.
@mixin inset-y($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|String | Required | Spacing key (4), negative key (-4), fraction key (25p, -25p; 33p gives 33.333%), auto, or a raw length, percentage, calc() or var() |
Example
.side-rail { @include absolute; @include inset-y(0); @include left(0);}.side-rail { position: absolute; top: var(--nu-space-0); bottom: var(--nu-space-0); left: var(--nu-space-0);}inset-auto mixinSets the inset shorthand to auto on all four sides.
@mixin inset-autoExample
.popover { @include inset-auto;}.popover { inset: auto;}inset-x-auto mixinSets the physical left and right offsets to auto.
@mixin inset-x-autoExample
.tooltip { @include inset-x-auto;}.tooltip { left: auto; right: auto;}inset-y-auto mixinSets the top and bottom offsets to auto.
@mixin inset-y-autoExample
.tooltip { @include inset-y-auto;}.tooltip { top: auto; bottom: auto;}absolute-center mixinCenters an element absolutely within its positioned parent using top and left 50% and a -50% translate.
@mixin absolute-centerExample
.modal { @include absolute-center;}.modal { position: absolute; left: 50%; top: 50%; transform: translateX(var(--nu-translate-x)) translateY(var(--nu-translate-y)) translateZ(var(--nu-translate-z)) rotate(var(--nu-rotate)) skewX(var(--nu-skew-x)) skewY(var(--nu-skew-y)) scaleX(var(--nu-scale-x)) scaleY(var(--nu-scale-y)); --nu-translate-x: -50%; --nu-translate-y: -50%;}shadow-base shadow shadow-inset elevation
shadow-base mixinSets box-shadow from explicit offset, blur, spread and colour values.
@mixin shadow-base($x, $y, $blur, $spread, $color)| Parameter | Type | Default | Description |
|---|---|---|---|
$x | Length|Number | Required | Horizontal offset |
$y | Length|Number | Required | Vertical offset |
$blur | Length|Number | Required | Blur radius |
$spread | Length|Number | Required | Spread radius |
$color | Color|String | Required | Shadow colour |
Example
.floating-button { @include shadow-base(0, 2px, 4px, 0, rgb(0 0 0 / 20%));}.floating-button { box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2);}shadow mixinSets box-shadow from a configured size; the default colour emits the var(--nu-shadow-*) token when the theme feature is on, other colours emit a raw shadow.
@mixin shadow($size: "md", $color: "default")| Parameter | Type | Default | Description |
|---|---|---|---|
$size | String | "md" | Size key from $shadow-sizes (sm, md, lg, xl, hero, monster), or none (box-shadow: none, as .shadow-none) |
$color | String | "default" | Colour key from $shadow-colors (default, dark, darker, darkest) |
Example
.card { @include shadow(sm); // box-shadow: var(--nu-shadow-sm) &:hover { @include shadow(lg, dark); }}.card { box-shadow: var(--nu-shadow-sm);}.card:hover { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);}Note. Unknown size or colour keys raise an error.
shadow-inset mixinSets an inset box-shadow from a configured size and colour, always as a raw value (no token).
@mixin shadow-inset($size: "md", $color: "default")| Parameter | Type | Default | Description |
|---|---|---|---|
$size | String | "md" | Size key from $shadow-sizes (sm, md, lg, xl, hero, monster) |
$color | String | "default" | Colour key from $shadow-colors (default, dark, darker, darkest) |
Example
.input-well { @include shadow-inset(sm);}.input-well { box-shadow: inset 0 1px 2px 0 rgba(0, 0, 0, 0.1);}elevation mixinSets a shadow and a matching z-index for levels 1 to 5 (sm, md, lg, xl, monster); other levels raise an error.
@mixin elevation($i)| Parameter | Type | Default | Description |
|---|---|---|---|
$i | Number | Required | Elevation level from 1 to 5, also emitted as the raw z-index |
Example
.dropdown-panel { @include elevation(3); // box-shadow: var(--nu-shadow-lg); z-index: 3}.dropdown-panel { box-shadow: var(--nu-shadow-lg); z-index: 3;}Note. The z-index is the level itself (1 to 5), a small local scale that orders raised siblings; it is not a $z-index-levels token. Use z-index(dropdown), z-index(modal) and the other level tokens for page layers.
width height min-width min-height max-width max-height width-percent height-percent min-width-percent min-height-percent max-width-percent max-height-percent w-auto w-full h-auto h-full w-max h-max w-min h-min w-fit h-fit min-w-full max-w-full min-h-full max-h-full w-screen h-screen
width mixinSets width from a spacing key, a percentage key, a breakpoint name, a sizing keyword or a raw value; negative keys and unknown words raise an error.
@mixin width($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | Spacing key (4), percentage key (50p gives 50%, 33p gives 33.333%), breakpoint name (lg gives its width), auto, min-content, max-content, fit-content, or a raw length, percentage, calc() or var() |
Example
.sidebar { @include width(20rem);}.sidebar { width: 20rem;}height mixinSets height from a spacing key, a percentage key, a sizing keyword or a raw value; negative keys and unknown words raise an error.
@mixin height($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | Spacing key (4), percentage key (50p gives 50%, 33p gives 33.333%), auto, min-content, max-content, fit-content, or a raw length, percentage, calc() or var() |
Example
.avatar { @include height(12); // height: var(--nu-space-12)}.avatar { height: var(--nu-space-12);}min-width mixinSets min-width from a spacing key, a percentage key, a breakpoint name, a sizing keyword or a raw value; negative keys and unknown words raise an error.
@mixin min-width($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | Spacing key (4), percentage key (50p gives 50%, 33p gives 33.333%), breakpoint name (lg gives its width), auto, min-content, max-content, fit-content, or a raw length, percentage, calc() or var() |
Example
.dialog { @include min-width(16); // min-width: var(--nu-space-16)}.dialog { min-width: var(--nu-space-16);}min-height mixinSets min-height from a spacing key, a percentage key, a sizing keyword or a raw value; negative keys and unknown words raise an error.
@mixin min-height($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | Spacing key (4), percentage key (50p gives 50%, 33p gives 33.333%), auto, min-content, max-content, fit-content, or a raw length, percentage, calc() or var() |
Example
.drop-zone { @include min-height(10rem);}.drop-zone { min-height: 10rem;}max-width mixinSets max-width from a spacing key, a percentage key, a breakpoint name, a sizing keyword, none or a raw value; negative keys and unknown words raise an error.
@mixin max-width($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | Spacing key (4), percentage key (50p gives 50%, 33p gives 33.333%), breakpoint name (lg gives its width), auto, min-content, max-content, fit-content, none, or a raw length, percentage, calc() or var() |
Example
.article { @include max-width(48rem);}.article { max-width: 48rem;}max-height mixinSets max-height from a spacing key, a percentage key, a sizing keyword, none or a raw value; negative keys and unknown words raise an error.
@mixin max-height($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | Spacing key (4), percentage key (50p gives 50%, 33p gives 33.333%), auto, min-content, max-content, fit-content, none, or a raw length, percentage, calc() or var() |
Example
.dropdown-menu { @include max-height(64);}.dropdown-menu { max-height: var(--nu-space-64);}width-percent mixinSets width as a percentage from a unitless number or a percentage; any other value raises an error.
@mixin width-percent($i)| Parameter | Type | Default | Description |
|---|---|---|---|
$i | Number|Percentage | Required | Unitless number (50 gives 50%; 33 and 66 give the exact thirds 33.333% and 66.667%) or a percentage (50%) |
Example
.column { @include width-percent(50); // width: 50%}.column { width: 50%;}height-percent mixinSets height as a percentage from a unitless number or a percentage; any other value raises an error.
@mixin height-percent($i)| Parameter | Type | Default | Description |
|---|---|---|---|
$i | Number|Percentage | Required | Unitless number (50 gives 50%; 33 and 66 give the exact thirds 33.333% and 66.667%) or a percentage (50%) |
Example
.chart { @include height-percent(75); // height: 75%}.chart { height: 75%;}min-width-percent mixinSets min-width as a percentage from a unitless number or a percentage; any other value raises an error.
@mixin min-width-percent($i)| Parameter | Type | Default | Description |
|---|---|---|---|
$i | Number|Percentage | Required | Unitless number (50 gives 50%; 33 and 66 give the exact thirds 33.333% and 66.667%) or a percentage (50%) |
Example
.search { @include min-width-percent(30); // min-width: 30%}.search { min-width: 30%;}min-height-percent mixinSets min-height as a percentage from a unitless number or a percentage; any other value raises an error.
@mixin min-height-percent($i)| Parameter | Type | Default | Description |
|---|---|---|---|
$i | Number|Percentage | Required | Unitless number (50 gives 50%; 33 and 66 give the exact thirds 33.333% and 66.667%) or a percentage (50%) |
Example
.hero { @include min-height-percent(50); // min-height: 50%}.hero { min-height: 50%;}max-width-percent mixinSets max-width as a percentage from a unitless number or a percentage; any other value raises an error.
@mixin max-width-percent($i)| Parameter | Type | Default | Description |
|---|---|---|---|
$i | Number|Percentage | Required | Unitless number (50 gives 50%; 33 and 66 give the exact thirds 33.333% and 66.667%) or a percentage (50%) |
Example
.toast { @include max-width-percent(90); // max-width: 90%}.toast { max-width: 90%;}max-height-percent mixinSets max-height as a percentage from a unitless number or a percentage; any other value raises an error.
@mixin max-height-percent($i)| Parameter | Type | Default | Description |
|---|---|---|---|
$i | Number|Percentage | Required | Unitless number (50 gives 50%; 33 and 66 give the exact thirds 33.333% and 66.667%) or a percentage (50%) |
Example
.modal-body { @include max-height-percent(80); // max-height: 80%}.modal-body { max-height: 80%;}w-auto mixinSets width to auto.
@mixin w-autoExample
.image { @include w-auto;}.image { width: auto;}w-full mixinSets width to 100%.
@mixin w-fullExample
.input-group { @include w-full;}.input-group { width: 100%;}h-auto mixinSets height to auto.
@mixin h-autoExample
.image { @include h-auto;}.image { height: auto;}h-full mixinSets height to 100%.
@mixin h-fullExample
.panel { @include h-full;}.panel { height: 100%;}w-max mixinSets width to max-content.
@mixin w-maxExample
.menu { @include w-max;}.menu { width: max-content;}h-max mixinSets height to max-content.
@mixin h-maxExample
.menu { @include h-max;}.menu { height: max-content;}w-min mixinSets width to min-content.
@mixin w-minExample
.label { @include w-min;}.label { width: min-content;}h-min mixinSets height to min-content.
@mixin h-minExample
.label { @include h-min;}.label { height: min-content;}w-fit mixinSets width to fit-content.
@mixin w-fitExample
.chip { @include w-fit;}.chip { width: fit-content;}h-fit mixinSets height to fit-content.
@mixin h-fitExample
.chip { @include h-fit;}.chip { height: fit-content;}min-w-full mixinSets min-width to 100%.
@mixin min-w-fullExample
.table { @include min-w-full;}.table { min-width: 100%;}max-w-full mixinSets max-width to 100%.
@mixin max-w-fullExample
.media { @include max-w-full;}.media { max-width: 100%;}min-h-full mixinSets min-height to 100%.
@mixin min-h-fullExample
.layout { @include min-h-full;}.layout { min-height: 100%;}max-h-full mixinSets max-height to 100%.
@mixin max-h-fullExample
.media { @include max-h-full;}.media { max-height: 100%;}w-screen mixinSets width to 100vw, the full viewport width.
@mixin w-screenExample
.backdrop { @include w-screen;}.backdrop { width: 100vw;}h-screen mixinSets height to 100dvh, the full dynamic viewport height.
@mixin h-screenExample
.app-shell { @include h-screen;}.app-shell { height: 100dvh;}Controls element margins, padding, gaps, and spacing between children
p px py pt pr pb pl ps pe m mx my mt mr mb ml ms me ml-auto mr-auto ms-auto me-auto mx-auto space-y space-x gap gap-x gap-y
p mixinSets padding on all sides from a spacing key or a raw value.
@mixin p($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key (4 gives var(--nu-space-4)), or a value with a unit, calc() or var(); negative keys and auto raise an error |
Example 1
.card { @include p(4); // padding: var(--nu-space-4)}.card { padding: var(--nu-space-4);}Example 2
.card-wide { @include p(1.5rem); // padding: 1.5rem}.card-wide { padding: 1.5rem;}px mixinSets padding on the inline start and end (padding-inline), following text direction.
@mixin px($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key (4 gives var(--nu-space-4)), or a value with a unit, calc() or var(); negative keys and auto raise an error |
Example 1
.button { @include px(4); // padding-inline: var(--nu-space-4)}.button { padding-inline: var(--nu-space-4);}Example 2
.chip { @include apply(px(2), py(1));}.chip { padding-inline: var(--nu-space-2); padding-block: var(--nu-space-1);}py mixinSets padding on the block start and end (padding-block), top and bottom in horizontal writing modes.
@mixin py($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key (4 gives var(--nu-space-4)), or a value with a unit, calc() or var(); negative keys and auto raise an error |
Example 1
.button { @include py(2); // padding-block: var(--nu-space-2)}.button { padding-block: var(--nu-space-2);}Example 2
.row { @include py(0.625rem); // padding-block: 0.625rem}.row { padding-block: 0.625rem;}pt mixinSets padding-top from a spacing key or a raw value.
@mixin pt($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key (4 gives var(--nu-space-4)), or a value with a unit, calc() or var(); negative keys and auto raise an error |
Example 1
.section { @include pt(4); // padding-top: var(--nu-space-4)}.section { padding-top: var(--nu-space-4);}Example 2
.section-wide { @include pt(1.5rem); // padding-top: 1.5rem}.section-wide { padding-top: 1.5rem;}pr mixinSets padding-right (physical, does not follow text direction) from a spacing key or a raw value.
@mixin pr($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key (4 gives var(--nu-space-4)), or a value with a unit, calc() or var(); negative keys and auto raise an error |
Example 1
.gutter { @include pr(4); // padding-right: var(--nu-space-4)}.gutter { padding-right: var(--nu-space-4);}Example 2
.gutter-wide { @include pr(1.5rem); // padding-right: 1.5rem}.gutter-wide { padding-right: 1.5rem;}pb mixinSets padding-bottom from a spacing key or a raw value.
@mixin pb($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key (4 gives var(--nu-space-4)), or a value with a unit, calc() or var(); negative keys and auto raise an error |
Example 1
.section { @include pb(4); // padding-bottom: var(--nu-space-4)}.section { padding-bottom: var(--nu-space-4);}Example 2
.section-wide { @include pb(1.5rem); // padding-bottom: 1.5rem}.section-wide { padding-bottom: 1.5rem;}pl mixinSets padding-left (physical, does not follow text direction) from a spacing key or a raw value.
@mixin pl($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key (4 gives var(--nu-space-4)), or a value with a unit, calc() or var(); negative keys and auto raise an error |
Example 1
.gutter { @include pl(4); // padding-left: var(--nu-space-4)}.gutter { padding-left: var(--nu-space-4);}Example 2
.gutter-wide { @include pl(1.5rem); // padding-left: 1.5rem}.gutter-wide { padding-left: 1.5rem;}ps mixinSets padding-inline-start (left in LTR, right in RTL) from a spacing key or a raw value.
@mixin ps($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key (4 gives var(--nu-space-4)), or a value with a unit, calc() or var(); negative keys and auto raise an error |
Example 1
.list { @include ps(4); // padding-inline-start: var(--nu-space-4)}.list { padding-inline-start: var(--nu-space-4);}Example 2
.list-wide { @include ps(1.5rem); // padding-inline-start: 1.5rem}.list-wide { padding-inline-start: 1.5rem;}pe mixinSets padding-inline-end (right in LTR, left in RTL) from a spacing key or a raw value.
@mixin pe($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key (4 gives var(--nu-space-4)), or a value with a unit, calc() or var(); negative keys and auto raise an error |
Example 1
.input { @include pe(4); // padding-inline-end: var(--nu-space-4)}.input { padding-inline-end: var(--nu-space-4);}Example 2
.input-wide { @include pe(1.5rem); // padding-inline-end: 1.5rem}.input-wide { padding-inline-end: 1.5rem;}m mixinSets margin on all sides from a spacing key, a negative key, auto or a raw value.
@mixin m($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key (4 gives var(--nu-space-4)), a negative key, auto, or a value with a unit, calc() or var() |
Example 1
.card { @include m(4); // margin: var(--nu-space-4)}.card { margin: var(--nu-space-4);}Example 2
.bleed { @include m(-2); // margin: calc(-1 * var(--nu-space-2))}.bleed { margin: calc(-1 * var(--nu-space-2));}mx mixinSets margin on the inline start and end (margin-inline), following text direction.
@mixin mx($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key (4 gives var(--nu-space-4)), a negative key, auto, or a value with a unit, calc() or var() |
Example 1
.divider { @include mx(4); // margin-inline: var(--nu-space-4)}.divider { margin-inline: var(--nu-space-4);}Example 2
.bleed { @include mx(-4); // margin-inline: calc(-1 * var(--nu-space-4))}.bleed { margin-inline: calc(-1 * var(--nu-space-4));}my mixinSets margin on the block start and end (margin-block), top and bottom in horizontal writing modes.
@mixin my($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key (4 gives var(--nu-space-4)), a negative key, auto, or a value with a unit, calc() or var() |
Example 1
.divider { @include my(6); // margin-block: var(--nu-space-6)}.divider { margin-block: var(--nu-space-6);}Example 2
.hr { @include my(1.5rem); // margin-block: 1.5rem}.hr { margin-block: 1.5rem;}mt mixinSets margin-top from a spacing key, a negative key, auto or a raw value.
@mixin mt($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key (4 gives var(--nu-space-4)), a negative key, auto, or a value with a unit, calc() or var() |
Example 1
.section { @include mt(4); // margin-top: var(--nu-space-4)}.section { margin-top: var(--nu-space-4);}Example 2
.section-pull { @include mt(-2); // margin-top: calc(-1 * var(--nu-space-2))}.section-pull { margin-top: calc(-1 * var(--nu-space-2));}mr mixinSets margin-right (physical, does not follow text direction) from a spacing key, a negative key, auto or a raw value.
@mixin mr($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key (4 gives var(--nu-space-4)), a negative key, auto, or a value with a unit, calc() or var() |
Example 1
.icon { @include mr(4); // margin-right: var(--nu-space-4)}.icon { margin-right: var(--nu-space-4);}Example 2
.icon-pull { @include mr(-2); // margin-right: calc(-1 * var(--nu-space-2))}.icon-pull { margin-right: calc(-1 * var(--nu-space-2));}mb mixinSets margin-bottom from a spacing key, a negative key, auto or a raw value.
@mixin mb($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key (4 gives var(--nu-space-4)), a negative key, auto, or a value with a unit, calc() or var() |
Example 1
.heading { @include mb(4); // margin-bottom: var(--nu-space-4)}.heading { margin-bottom: var(--nu-space-4);}Example 2
.heading-pull { @include mb(-2); // margin-bottom: calc(-1 * var(--nu-space-2))}.heading-pull { margin-bottom: calc(-1 * var(--nu-space-2));}ml mixinSets margin-left (physical, does not follow text direction) from a spacing key, a negative key, auto or a raw value.
@mixin ml($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key (4 gives var(--nu-space-4)), a negative key, auto, or a value with a unit, calc() or var() |
Example 1
.icon { @include ml(4); // margin-left: var(--nu-space-4)}.icon { margin-left: var(--nu-space-4);}Example 2
.icon-pull { @include ml(-2); // margin-left: calc(-1 * var(--nu-space-2))}.icon-pull { margin-left: calc(-1 * var(--nu-space-2));}ms mixinSets margin-inline-start (left in LTR, right in RTL) from a spacing key, a negative key, auto or a raw value.
@mixin ms($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key (4 gives var(--nu-space-4)), a negative key, auto, or a value with a unit, calc() or var() |
Example 1
.icon { @include ms(4); // margin-inline-start: var(--nu-space-4)}.icon { margin-inline-start: var(--nu-space-4);}Example 2
.icon-pull { @include ms(-2); // margin-inline-start: calc(-1 * var(--nu-space-2))}.icon-pull { margin-inline-start: calc(-1 * var(--nu-space-2));}me mixinSets margin-inline-end (right in LTR, left in RTL) from a spacing key, a negative key, auto or a raw value.
@mixin me($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key (4 gives var(--nu-space-4)), a negative key, auto, or a value with a unit, calc() or var() |
Example 1
.icon { @include me(4); // margin-inline-end: var(--nu-space-4)}.icon { margin-inline-end: var(--nu-space-4);}Example 2
.icon-pull { @include me(-2); // margin-inline-end: calc(-1 * var(--nu-space-2))}.icon-pull { margin-inline-end: calc(-1 * var(--nu-space-2));}ml-auto mixinSets margin-left to auto (physical), pushing the element to the right in a flex row.
@mixin ml-autoExample
.actions { @include ml-auto; // margin-left: auto}.actions { margin-left: auto;}mr-auto mixinSets margin-right to auto (physical), pushing the element to the left in a flex row.
@mixin mr-autoExample
.logo { @include mr-auto; // margin-right: auto}.logo { margin-right: auto;}ms-auto mixinSets margin-inline-start to auto, pushing the element to the inline end in a flex row.
@mixin ms-autoExample
.actions { @include ms-auto; // margin-inline-start: auto}.actions { margin-inline-start: auto;}me-auto mixinSets margin-inline-end to auto, pushing the element to the inline start in a flex row.
@mixin me-autoExample
.logo { @include me-auto; // margin-inline-end: auto}.logo { margin-inline-end: auto;}mx-auto mixinCenters a block element on the inline axis with margin-inline: auto.
@mixin mx-autoExample
.container { @include apply(max-width(64rem), mx-auto);}.container { max-width: 64rem; margin-inline: auto;}space-y mixinAdds margin-block-start to every direct child after the first, spacing children along the block axis (vertically in horizontal writing modes).
@mixin space-y($i)| Parameter | Type | Default | Description |
|---|---|---|---|
$i | Number|Length|Calculation|String | Required | Spacing key, a negative key, or a value with a unit, calc() or var() |
Example
.stack { @include space-y(4); // .stack > * + * { margin-block-start: var(--nu-space-4) }}.stack > * + * { margin-block-start: var(--nu-space-4);}space-x mixinAdds margin-inline-start to every direct child after the first, spacing children along the inline axis.
@mixin space-x($i)| Parameter | Type | Default | Description |
|---|---|---|---|
$i | Number|Length|Calculation|String | Required | Spacing key, a negative key, or a value with a unit, calc() or var() |
Example
.toolbar { @include space-x(2); // .toolbar > * + * { margin-inline-start: var(--nu-space-2) }}.toolbar > * + * { margin-inline-start: var(--nu-space-2);}gap mixinSets gap on a flex or grid container and passes it to direct children as --nu-flex-gap for fill() widths.
@mixin gap($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key, normal, or a value with a unit, calc() or var(); negative keys raise an error |
Example 1
.grid { @include gap(4); // gap: var(--nu-space-4)}.grid { gap: var(--nu-space-4);}.grid > * { --nu-flex-gap: var(--nu-space-4);}Example 2
.cards { @include apply(flex, gap(1.25rem));}.cards { display: flex; gap: 1.25rem;}.cards > * { --nu-flex-gap: 1.25rem;}gap-x mixinSets column-gap on a flex or grid container and passes it to direct children as --nu-flex-gap for fill() widths.
@mixin gap-x($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key, normal, or a value with a unit, calc() or var(); negative keys raise an error |
Example
.row { @include gap-x(6); // column-gap: var(--nu-space-6)}.row { column-gap: var(--nu-space-6);}.row > * { --nu-flex-gap: var(--nu-space-6);}gap-y mixinSets row-gap on a flex or grid container; --nu-flex-gap is not set because it only feeds inline widths.
@mixin gap-y($val)| Parameter | Type | Default | Description |
|---|---|---|---|
$val | Number|Length|Calculation|String | Required | Spacing key, normal, or a value with a unit, calc() or var(); negative keys raise an error |
Example
.column { @include gap-y(2); // row-gap: var(--nu-space-2)}.column { row-gap: var(--nu-space-2);}apply-transform translate-x translate-y translate-z translate scale-x scale-y scale rotate skew-x skew-y origin
apply-transform mixinWrites the transform property that combines every --nu-translate-*, --nu-rotate, --nu-skew-* and --nu-scale-* variable; the transform mixins include it.
@mixin apply-transformtransform: translateX(var(--nu-translate-x)) ... scaleY(var(--nu-scale-y)), with no fallbacks; unset variables use their @property initial valuesExample
.icon { --nu-rotate: 90deg; @include apply-transform;}.icon { --nu-rotate: 90deg; transform: translateX(var(--nu-translate-x)) translateY(var(--nu-translate-y)) translateZ(var(--nu-translate-z)) rotate(var(--nu-rotate)) skewX(var(--nu-skew-x)) skewY(var(--nu-skew-y)) scaleX(var(--nu-scale-x)) scaleY(var(--nu-scale-y));}translate-x mixinMoves the element along the x axis by setting --nu-translate-x and writing the combined transform.
@mixin translate-x($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | A $spacings key (4 gives var(--nu-space-4)), a negated key (-4 gives calc(-1 * token)), a fraction key (25p, -25p), a length, percentage, calc() or var() |
Example 1
.drawer { @include translate-x(4);}.drawer { --nu-translate-x: var(--nu-space-4); transform: translateX(var(--nu-translate-x)) translateY(var(--nu-translate-y)) translateZ(var(--nu-translate-z)) rotate(var(--nu-rotate)) skewX(var(--nu-skew-x)) skewY(var(--nu-skew-y)) scaleX(var(--nu-scale-x)) scaleY(var(--nu-scale-y));}Example 2
.card { @include apply(translate-x(-50p) hover);}.card:hover { --nu-translate-x: -50%; transform: translateX(var(--nu-translate-x)) translateY(var(--nu-translate-y)) translateZ(var(--nu-translate-z)) rotate(var(--nu-rotate)) skewX(var(--nu-skew-x)) skewY(var(--nu-skew-y)) scaleX(var(--nu-scale-x)) scaleY(var(--nu-scale-y));}Note. A unitless number that is not a spacing key raises an error.
translate-y mixinMoves the element along the y axis by setting --nu-translate-y and writing the combined transform.
@mixin translate-y($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | A $spacings key (4 gives var(--nu-space-4)), a negated key (-4 gives calc(-1 * token)), a fraction key (25p, -25p), a length, percentage, calc() or var() |
Example 1
.drawer { @include translate-y(-1);}.drawer { --nu-translate-y: calc(-1 * var(--nu-space-1)); transform: translateX(var(--nu-translate-x)) translateY(var(--nu-translate-y)) translateZ(var(--nu-translate-z)) rotate(var(--nu-rotate)) skewX(var(--nu-skew-x)) skewY(var(--nu-skew-y)) scaleX(var(--nu-scale-x)) scaleY(var(--nu-scale-y));}Example 2
.card { @include apply(translate-y(100%) hover);}.card:hover { --nu-translate-y: 100%; transform: translateX(var(--nu-translate-x)) translateY(var(--nu-translate-y)) translateZ(var(--nu-translate-z)) rotate(var(--nu-rotate)) skewX(var(--nu-skew-x)) skewY(var(--nu-skew-y)) scaleX(var(--nu-scale-x)) scaleY(var(--nu-scale-y));}Note. A unitless number that is not a spacing key raises an error.
translate-z mixinMoves the element along the z axis by setting --nu-translate-z and writing the combined transform.
@mixin translate-z($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Length|String | Required | A $spacings key, a negated key, a length, calc() or var() |
Example
.layer { @include translate-z(10px);}.layer { --nu-translate-z: 10px; transform: translateX(var(--nu-translate-x)) translateY(var(--nu-translate-y)) translateZ(var(--nu-translate-z)) rotate(var(--nu-rotate)) skewX(var(--nu-skew-x)) skewY(var(--nu-skew-y)) scaleX(var(--nu-scale-x)) scaleY(var(--nu-scale-y));}Note. A unitless number that is not a spacing key raises an error, as do percentages and fraction keys (50%, 50p): the z axis takes a length.
translate mixinMoves the element on the x axis, and on the y axis when $y is given, then writes the combined transform.
@mixin translate($x, $y: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$x | Number|Length|String | Required | A $spacings key (4 gives var(--nu-space-4)), a negated key (-4 gives calc(-1 * token)), a fraction key (25p, -25p), a length, percentage, calc() or var() |
$y | Number|Length|String|Null | null | Same values as $x; when null, --nu-translate-y is left unchanged |
Example
.tooltip { @include translate(-50p, 2);}.tooltip { --nu-translate-x: -50%; --nu-translate-y: var(--nu-space-2); transform: translateX(var(--nu-translate-x)) translateY(var(--nu-translate-y)) translateZ(var(--nu-translate-z)) rotate(var(--nu-rotate)) skewX(var(--nu-skew-x)) skewY(var(--nu-skew-y)) scaleX(var(--nu-scale-x)) scaleY(var(--nu-scale-y));}Note. A single argument moves the x axis only.
scale-x mixinScales the element horizontally by setting --nu-scale-x and writing the combined transform.
@mixin scale-x($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Percentage|String | Required | A $scale-values key (0, 50, 75, 90, 95, 100, 105, 110, 125, 150; 150 gives 1.5) a factor such as 1.5, a percentage, calc() or var(); any other word raises an error |
Example
.thumb { @include scale-x(110);}.thumb { --nu-scale-x: 1.1; transform: translateX(var(--nu-translate-x)) translateY(var(--nu-translate-y)) translateZ(var(--nu-translate-z)) rotate(var(--nu-rotate)) skewX(var(--nu-skew-x)) skewY(var(--nu-skew-y)) scaleX(var(--nu-scale-x)) scaleY(var(--nu-scale-y));}Note. Keys win over factors, so scale(100) is 1 and scale(50) is 0.5.
scale-y mixinScales the element vertically by setting --nu-scale-y and writing the combined transform.
@mixin scale-y($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Percentage|String | Required | A $scale-values key (0, 50, 75, 90, 95, 100, 105, 110, 125, 150; 150 gives 1.5) a factor such as 1.5, a percentage, calc() or var(); any other word raises an error |
Example
.thumb { @include scale-y(1.5);}.thumb { --nu-scale-y: 1.5; transform: translateX(var(--nu-translate-x)) translateY(var(--nu-translate-y)) translateZ(var(--nu-translate-z)) rotate(var(--nu-rotate)) skewX(var(--nu-skew-x)) skewY(var(--nu-skew-y)) scaleX(var(--nu-scale-x)) scaleY(var(--nu-scale-y));}Note. Keys win over factors, so scale(100) is 1 and scale(50) is 0.5.
scale mixinScales the element on both axes by setting --nu-scale-x and --nu-scale-y and writing the combined transform.
@mixin scale($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|Percentage|String | Required | A $scale-values key (0, 50, 75, 90, 95, 100, 105, 110, 125, 150; 150 gives 1.5) a factor such as 1.5, a percentage, calc() or var(); any other word raises an error |
Example 1
.thumb { @include scale(105);}.thumb { --nu-scale-x: 1.05; --nu-scale-y: 1.05; transform: translateX(var(--nu-translate-x)) translateY(var(--nu-translate-y)) translateZ(var(--nu-translate-z)) rotate(var(--nu-rotate)) skewX(var(--nu-skew-x)) skewY(var(--nu-skew-y)) scaleX(var(--nu-scale-x)) scaleY(var(--nu-scale-y));}Example 2
.card { @include apply(scale(105) hover, transition-transform);}.card:hover { --nu-scale-x: 1.05; --nu-scale-y: 1.05; transform: translateX(var(--nu-translate-x)) translateY(var(--nu-translate-y)) translateZ(var(--nu-translate-z)) rotate(var(--nu-rotate)) skewX(var(--nu-skew-x)) skewY(var(--nu-skew-y)) scaleX(var(--nu-scale-x)) scaleY(var(--nu-scale-y));}.card { transition-property: transform; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out);}Note. Keys win over factors, so scale(100) is 1 and scale(50) is 0.5.
rotate mixinRotates the element by setting --nu-rotate and writing the combined transform.
@mixin rotate($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|String | Required | A $rotation-values key (0, 45, 90, 180, 270; 45 gives 45deg as in .rotate-45), a negated key (-45), an angle with a unit (30deg, 0.25turn), calc() or var() |
Example
.chevron { @include apply(rotate(180) hover);}.chevron:hover { --nu-rotate: 180deg; transform: translateX(var(--nu-translate-x)) translateY(var(--nu-translate-y)) translateZ(var(--nu-translate-z)) rotate(var(--nu-rotate)) skewX(var(--nu-skew-x)) skewY(var(--nu-skew-y)) scaleX(var(--nu-scale-x)) scaleY(var(--nu-scale-y));}Note. 0 is written 0deg. Another unitless number, such as 30, and any other word raise an error.
skew-x mixinSkews the element along the x axis by setting --nu-skew-x and writing the combined transform.
@mixin skew-x($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|String | Required | An angle with a unit (6deg), calc(), var() or 0 (written 0deg) |
Example
.ribbon { @include skew-x(6deg);}.ribbon { --nu-skew-x: 6deg; transform: translateX(var(--nu-translate-x)) translateY(var(--nu-translate-y)) translateZ(var(--nu-translate-z)) rotate(var(--nu-rotate)) skewX(var(--nu-skew-x)) skewY(var(--nu-skew-y)) scaleX(var(--nu-scale-x)) scaleY(var(--nu-scale-y));}Note. A unitless non-zero number or any other word raises an error.
skew-y mixinSkews the element along the y axis by setting --nu-skew-y and writing the combined transform.
@mixin skew-y($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|String | Required | An angle with a unit (6deg), calc(), var() or 0 (written 0deg) |
Example
.ribbon { @include skew-y(-3deg);}.ribbon { --nu-skew-y: -3deg; transform: translateX(var(--nu-translate-x)) translateY(var(--nu-translate-y)) translateZ(var(--nu-translate-z)) rotate(var(--nu-rotate)) skewX(var(--nu-skew-x)) skewY(var(--nu-skew-y)) scaleX(var(--nu-scale-x)) scaleY(var(--nu-scale-y));}Note. A unitless non-zero number or any other word raises an error.
origin mixinSets transform-origin from an $origin-values key (top-left gives top left, matching .origin-top-left) or a transform-origin value.
@mixin origin($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | String|Length|List | Required | An $origin-values key (center, top, top-right, right, bottom-right, bottom, bottom-left, left, top-left) or a transform-origin value of position keywords, lengths, percentages, calc() or var(), such as top left or 50% 100%; anything else raises an error |
Example 1
.menu { @include origin(top-left); // transform-origin: top left}.menu { transform-origin: top left;}Example 2
.badge { @include origin(50% 100%);}.badge { transform-origin: 50% 100%;}transition-none transition transition-colors transition-opacity transition-shadow transition-transform duration ease ease-linear ease-in ease-out ease-in-out delay
transition-none mixinDisables transitions by setting transition-property to none.
@mixin transition-noneExample
.no-motion { @include transition-none;}.no-motion { transition-property: none;}transition mixinTransitions every animatable property with the default duration and easing tokens ($transition-default-duration, 200; $transition-default-ease, in-out).
@mixin transitiontransition-property: all; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out)Example 1
.card { @include transition;}.card { transition-property: all; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out);}Example 2
.panel { @include apply(transition, duration(300));}.panel { transition-property: all; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out); transition-duration: var(--nu-duration-300);}Note. Include duration() or ease() after it to override a default.
transition-colors mixinTransitions colour properties (color, background-color, border-color, text-decoration-color, fill, stroke) with the default duration and easing tokens, like transition.
@mixin transition-colorstransition-property: color, background-color, ...; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out)Example
.button { @include apply(transition-colors, duration(150), ease(out));}.button { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out); transition-duration: var(--nu-duration-150); transition-timing-function: var(--nu-ease-out);}transition-opacity mixinTransitions opacity only, with the default duration and easing tokens, like transition.
@mixin transition-opacitytransition-property: opacity; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out)Example
.button { @include apply(transition-opacity, duration(150), ease(out));}.button { transition-property: opacity; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out); transition-duration: var(--nu-duration-150); transition-timing-function: var(--nu-ease-out);}transition-shadow mixinTransitions box-shadow only, with the default duration and easing tokens, like transition.
@mixin transition-shadowtransition-property: box-shadow; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out)Example
.button { @include apply(transition-shadow, duration(150), ease(out));}.button { transition-property: box-shadow; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out); transition-duration: var(--nu-duration-150); transition-timing-function: var(--nu-ease-out);}transition-transform mixinTransitions transform only, with the default duration and easing tokens, like transition.
@mixin transition-transformtransition-property: transform; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out)Example
.button { @include apply(transition-transform, duration(150), ease(out));}.button { transition-property: transform; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out); transition-duration: var(--nu-duration-150); transition-timing-function: var(--nu-ease-out);}duration mixinSets transition-duration from a $durations key, emitted as var(--nu-duration-*), or a raw time.
@mixin duration($time)| Parameter | Type | Default | Description |
|---|---|---|---|
$time | Number|Duration|String | Required | A $durations key (0, 75, 100, 150, 200, 300, 500, 700, 1000), a time in s or ms, calc() or var() |
Example 1
.panel { @include duration(300); // var(--nu-duration-300)}.panel { transition-duration: var(--nu-duration-300);}Example 2
.toast { @include apply(transition-opacity, duration(250ms));}.toast { transition-property: opacity; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out); transition-duration: 250ms;}Note. A unitless number that is not a key, a negative time, or a time in another unit raises an error.
ease mixinSets transition-timing-function from a $timing-functions key, emitted as var(--nu-ease-*), or a raw timing function.
@mixin ease($name)| Parameter | Type | Default | Description |
|---|---|---|---|
$name | String | Required | A $timing-functions key (linear, in, out, in-out), cubic-bezier(), steps(), linear(), var() or a CSS keyword (ease, ease-in, ease-out, ease-in-out, step-start, step-end) |
Example 1
.menu { @include ease(out); // var(--nu-ease-out)}.menu { transition-timing-function: var(--nu-ease-out);}Example 2
.sheet { @include apply(transition-transform, duration(300), ease(cubic-bezier(0.2, 0, 0, 1)));}.sheet { transition-property: transform; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out); transition-duration: var(--nu-duration-300); transition-timing-function: cubic-bezier(0.2, 0, 0, 1);}Note. Keys win over keywords, so ease(linear) gives var(--nu-ease-linear); any other value raises an error.
ease-linear mixinSets transition-timing-function to the linear key, var(--nu-ease-linear).
@mixin ease-linearExample
.fade { @include apply(transition-opacity, ease-linear);}.fade { transition-property: opacity; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out); transition-timing-function: var(--nu-ease-linear);}ease-in mixinSets transition-timing-function to the in key, var(--nu-ease-in).
@mixin ease-inExample
.fade { @include apply(transition-opacity, ease-in);}.fade { transition-property: opacity; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out); transition-timing-function: var(--nu-ease-in);}ease-out mixinSets transition-timing-function to the out key, var(--nu-ease-out).
@mixin ease-outExample
.fade { @include apply(transition-opacity, ease-out);}.fade { transition-property: opacity; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out); transition-timing-function: var(--nu-ease-out);}ease-in-out mixinSets transition-timing-function to the in-out key, var(--nu-ease-in-out).
@mixin ease-in-outExample
.fade { @include apply(transition-opacity, ease-in-out);}.fade { transition-property: opacity; transition-duration: var(--nu-duration-200); transition-timing-function: var(--nu-ease-in-out); transition-timing-function: var(--nu-ease-in-out);}delay mixinSets transition-delay from a $delays key or a raw time; delays are not tokens, so a key gives its configured time.
@mixin delay($time)| Parameter | Type | Default | Description |
|---|---|---|---|
$time | Number|Duration|String | Required | A $delays key (0, 75, 100, 150, 200, 300, 500, 700, 1000; 150 gives 150ms), a time in s or ms, calc() or var() |
Example
.tooltip { @include delay(300); // transition-delay: 300ms}.tooltip { transition-delay: 300ms;}Note. A unitless number that is not a key raises an error.
font-size font leading leading-none leading-tight leading-snug leading-normal leading-relaxed leading-loose text-left text-center text-right text-justify text-start text-end uppercase lowercase capitalize normal-case italic not-italic underline line-through no-underline break-normal break-words break-all whitespace-normal whitespace-nowrap whitespace-pre whitespace-pre-line whitespace-pre-wrap tracking tracking-tighter tracking-tight tracking-normal tracking-wide tracking-wider tracking-widest responsive-typography
font-size mixinSets font-size from a $font-sizes key (lg gives var(--nu-font-size-lg)) or a raw value; an unknown key or unitless number raises an error.
@mixin font-size($size)| Parameter | Type | Default | Description |
|---|---|---|---|
$size | String|Length|Calculation | Required | Font size key, 0, a value with a unit, calc(), var() or a CSS font-size keyword |
Example 1
.title { @include font-size(lg); // font-size: var(--nu-font-size-lg)}.title { font-size: var(--nu-font-size-lg);}Example 2
.hero { @include font-size(clamp(2rem, 5vw, 3rem));}.hero { font-size: clamp(2rem, 5vw, 3rem);}font mixinSets font-weight from a $font-weights key (bold gives var(--nu-font-weight-bold)) or a unitless number from 1 to 1000; anything else raises an error.
@mixin font($weight)| Parameter | Type | Default | Description |
|---|---|---|---|
$weight | String|Number | Required | Font weight key (thin to black) or a number from 1 to 1000 |
Example 1
.label { @include font(semibold); // font-weight: var(--nu-font-weight-semibold)}.label { font-weight: var(--nu-font-weight-semibold);}Example 2
.heading { @include apply(font-size(xl), font(bold), leading(tight));}.heading { font-size: var(--nu-font-size-xl); font-weight: var(--nu-font-weight-bold); line-height: var(--nu-line-height-tight);}leading mixinSets line-height from a $line-heights key (tight gives var(--nu-line-height-tight)) or a raw value; negative or unknown values raise an error.
@mixin leading($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | String|Number|Length|Calculation | Required | Line height key, a number or length of 0 or more (also as a string), calc(), var() or a keyword |
Example 1
.body { @include leading(relaxed); // line-height: var(--nu-line-height-relaxed)}.body { line-height: var(--nu-line-height-relaxed);}Example 2
.caption { @include leading(1.6); // line-height: 1.6}.caption { line-height: 1.6;}leading-none mixinSets line-height to the none key (var(--nu-line-height-none)); raises an error if the key is missing from $line-heights.
@mixin leading-noneExample
.text { @include leading-none; // line-height: var(--nu-line-height-none)}.text { line-height: var(--nu-line-height-none);}leading-tight mixinSets line-height to the tight key (var(--nu-line-height-tight)); raises an error if the key is missing from $line-heights.
@mixin leading-tightExample
.text { @include leading-tight; // line-height: var(--nu-line-height-tight)}.text { line-height: var(--nu-line-height-tight);}leading-snug mixinSets line-height to the snug key (var(--nu-line-height-snug)); raises an error if the key is missing from $line-heights.
@mixin leading-snugExample
.text { @include leading-snug; // line-height: var(--nu-line-height-snug)}.text { line-height: var(--nu-line-height-snug);}leading-normal mixinSets line-height to the normal key (var(--nu-line-height-normal)); raises an error if the key is missing from $line-heights.
@mixin leading-normalExample
.text { @include leading-normal; // line-height: var(--nu-line-height-normal)}.text { line-height: var(--nu-line-height-normal);}leading-relaxed mixinSets line-height to the relaxed key (var(--nu-line-height-relaxed)); raises an error if the key is missing from $line-heights.
@mixin leading-relaxedExample
.text { @include leading-relaxed; // line-height: var(--nu-line-height-relaxed)}.text { line-height: var(--nu-line-height-relaxed);}leading-loose mixinSets line-height to the loose key (var(--nu-line-height-loose)); raises an error if the key is missing from $line-heights.
@mixin leading-looseExample
.text { @include leading-loose; // line-height: var(--nu-line-height-loose)}.text { line-height: var(--nu-line-height-loose);}text-left mixinAligns text to the left (physical, does not follow text direction).
@mixin text-leftExample
.cell { @include text-left; // text-align: left}.cell { text-align: left;}text-center mixinCenters text.
@mixin text-centerExample
.title { @include text-center; // text-align: center}.title { text-align: center;}text-right mixinAligns text to the right (physical, does not follow text direction).
@mixin text-rightExample
.amount { @include text-right; // text-align: right}.amount { text-align: right;}text-justify mixinJustifies text to both edges.
@mixin text-justifyExample
.article { @include text-justify; // text-align: justify}.article { text-align: justify;}text-start mixinAligns text to the inline start: left in LTR, right in RTL.
@mixin text-startExample
.label { @include text-start; // text-align: start}.label { text-align: start;}text-end mixinAligns text to the inline end: right in LTR, left in RTL.
@mixin text-endExample
.amount { @include text-end; // text-align: end}.amount { text-align: end;}uppercase mixinTransforms text to uppercase.
@mixin uppercaseExample
.eyebrow { @include uppercase; // text-transform: uppercase}.eyebrow { text-transform: uppercase;}lowercase mixinTransforms text to lowercase.
@mixin lowercaseExample
.tag { @include lowercase; // text-transform: lowercase}.tag { text-transform: lowercase;}capitalize mixinCapitalizes the first letter of each word.
@mixin capitalizeExample
.name { @include capitalize; // text-transform: capitalize}.name { text-transform: capitalize;}normal-case mixinRemoves any text transform.
@mixin normal-caseExample
.plain { @include normal-case; // text-transform: none}.plain { text-transform: none;}italic mixinSets the font style to italic.
@mixin italicExample
.quote { @include italic; // font-style: italic}.quote { font-style: italic;}not-italic mixinResets the font style to normal.
@mixin not-italicExample
em { @include not-italic; // font-style: normal}em { font-style: normal;}underline mixinUnderlines text.
@mixin underlineExample
.link { @include underline; // text-decoration: underline}.link { text-decoration: underline;}line-through mixinDraws a line through text.
@mixin line-throughExample
.old-price { @include line-through; // text-decoration: line-through}.old-price { text-decoration: line-through;}no-underline mixinRemoves text decoration.
@mixin no-underlineExample
a.nav { @include no-underline; // text-decoration: none}a.nav { text-decoration: none;}break-normal mixinResets overflow-wrap and word-break to normal line breaking.
@mixin break-normalExample
.text { @include break-normal; // overflow-wrap: normal; word-break: normal}.text { overflow-wrap: normal; word-break: normal;}break-words mixinLets long words break onto the next line when they would overflow (overflow-wrap: break-word).
@mixin break-wordsExample
.url { @include break-words; // overflow-wrap: break-word}.url { overflow-wrap: break-word;}break-all mixinAllows line breaks between any two characters (word-break: break-all).
@mixin break-allExample
.hash { @include break-all; // word-break: break-all}.hash { word-break: break-all;}whitespace-normal mixinSets white-space to normal, collapsing spaces and wrapping lines.
@mixin whitespace-normalExample
.text { @include whitespace-normal; // white-space: normal}.text { white-space: normal;}whitespace-nowrap mixinPrevents text from wrapping (white-space: nowrap).
@mixin whitespace-nowrapExample
.text { @include whitespace-nowrap; // white-space: nowrap}.text { white-space: nowrap;}whitespace-pre mixinPreserves spaces and line breaks without wrapping (white-space: pre).
@mixin whitespace-preExample
.text { @include whitespace-pre; // white-space: pre}.text { white-space: pre;}whitespace-pre-line mixinCollapses spaces but keeps line breaks (white-space: pre-line).
@mixin whitespace-pre-lineExample
.text { @include whitespace-pre-line; // white-space: pre-line}.text { white-space: pre-line;}whitespace-pre-wrap mixinPreserves spaces and line breaks and wraps lines (white-space: pre-wrap).
@mixin whitespace-pre-wrapExample
.text { @include whitespace-pre-wrap; // white-space: pre-wrap}.text { white-space: pre-wrap;}tracking mixinSets letter-spacing from a key (tighter, tight, normal, wide, wider, widest; raw em values, not tokens) or a raw value; anything else raises an error.
@mixin tracking($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | String|Number|Length|Calculation | Required | Tracking key, 0, a value with a unit (also as a string), calc(), var() or a CSS-wide keyword |
Example 1
.eyebrow { @include tracking(wide); // letter-spacing: 0.025em}.eyebrow { letter-spacing: 0.025em;}Example 2
.logo { @include tracking(0.2em); // letter-spacing: 0.2em}.logo { letter-spacing: 0.2em;}tracking-tighter mixinSets letter-spacing to the tighter key (-0.05em).
@mixin tracking-tighterExample
.text { @include tracking-tighter; // letter-spacing: -0.05em}.text { letter-spacing: -0.05em;}tracking-tight mixinSets letter-spacing to the tight key (-0.025em).
@mixin tracking-tightExample
.text { @include tracking-tight; // letter-spacing: -0.025em}.text { letter-spacing: -0.025em;}tracking-normal mixinSets letter-spacing to the normal key (0).
@mixin tracking-normalExample
.text { @include tracking-normal; // letter-spacing: 0}.text { letter-spacing: 0;}tracking-wide mixinSets letter-spacing to the wide key (0.025em).
@mixin tracking-wideExample
.text { @include tracking-wide; // letter-spacing: 0.025em}.text { letter-spacing: 0.025em;}tracking-wider mixinSets letter-spacing to the wider key (0.05em).
@mixin tracking-widerExample
.text { @include tracking-wider; // letter-spacing: 0.05em}.text { letter-spacing: 0.05em;}tracking-widest mixinSets letter-spacing to the widest key (0.1em).
@mixin tracking-widestExample
.text { @include tracking-widest; // letter-spacing: 0.1em}.text { letter-spacing: 0.1em;}responsive-typography mixinEmits the typography utility classes (size, weight, line height, alignment, transform, style, decoration, tracking), suffixed with @breakpoint when a breakpoint is given.
@mixin responsive-typography($breakpoint: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$breakpoint | String|Null | null | Breakpoint name for the class suffix (also adds responsive truncate classes); null emits the base classes |
Example
@media (min-width: 1440px) { @include responsive-typography(wide);}@media (min-width: 1440px) { .text-xs\@wide { font-size: var(--nu-font-size-xs); } .text-sm\@wide { font-size: var(--nu-font-size-sm); } .text-md\@wide { font-size: var(--nu-font-size-md); } .text-base\@wide { font-size: var(--nu-font-size-base); } .text-lg\@wide { font-size: var(--nu-font-size-lg); } .text-xl\@wide { font-size: var(--nu-font-size-xl); } .text-2xl\@wide { font-size: var(--nu-font-size-2xl); } .text-3xl\@wide { font-size: var(--nu-font-size-3xl); } .text-4xl\@wide { font-size: var(--nu-font-size-4xl); } .font-thin\@wide { font-weight: var(--nu-font-weight-thin); } .font-extralight\@wide { font-weight: var(--nu-font-weight-extralight); } .font-light\@wide { font-weight: var(--nu-font-weight-light); } .font-normal\@wide { font-weight: var(--nu-font-weight-normal); } .font-medium\@wide { font-weight: var(--nu-font-weight-medium); } .font-semibold\@wide { font-weight: var(--nu-font-weight-semibold); } .font-bold\@wide { font-weight: var(--nu-font-weight-bold); } .font-extrabold\@wide { font-weight: var(--nu-font-weight-extrabold); } .font-black\@wide { font-weight: var(--nu-font-weight-black); } .leading-none\@wide { line-height: var(--nu-line-height-none); } .leading-tight\@wide { line-height: var(--nu-line-height-tight); } .leading-snug\@wide { line-height: var(--nu-line-height-snug); } .leading-normal\@wide { line-height: var(--nu-line-height-normal); } .leading-relaxed\@wide { line-height: var(--nu-line-height-relaxed); } .leading-loose\@wide { line-height: var(--nu-line-height-loose); } .text-left\@wide { text-align: left; } .text-center\@wide { text-align: center; } .text-right\@wide { text-align: right; } .text-justify\@wide { text-align: justify; } .text-start\@wide { text-align: start; } .text-end\@wide { text-align: end; } .uppercase\@wide { text-transform: uppercase; } .lowercase\@wide { text-transform: lowercase; } .capitalize\@wide { text-transform: capitalize; } .normal-case\@wide { text-transform: none; } .italic\@wide { font-style: italic; } .not-italic\@wide { font-style: normal; } .underline\@wide { text-decoration: underline; } .line-through\@wide { text-decoration: line-through; } .no-underline\@wide { text-decoration: none; } .truncate\@wide { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .truncate-2\@wide { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; } .truncate-3\@wide { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; } .truncate-4\@wide { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; } .truncate-5\@wide { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; } .overflow-label\@wide { white-space: nowrap; word-break: break-all; text-overflow: ellipsis; overflow: hidden; min-width: 0; } .tracking-tighter\@wide { letter-spacing: -0.05em; } .tracking-tight\@wide { letter-spacing: -0.025em; } .tracking-normal\@wide { letter-spacing: 0; } .tracking-wide\@wide { letter-spacing: 0.025em; } .tracking-wider\@wide { letter-spacing: 0.05em; } .tracking-widest\@wide { letter-spacing: 0.1em; }}z-index z-index-utilities z-base z-hover z-dropdown z-sticky z-fixed z-drawer z-modal z-popover z-tooltip z-overlay z-toast z-max z-auto
z-index mixinSets z-index from a numbered key (raw value), a named level (var(--nu-z-*) token), an integer, auto, calc() or var(); other values raise an error.
@mixin z-index($value)| Parameter | Type | Default | Description |
|---|---|---|---|
$value | Number|String | Required | Numbered key (10), named level (modal), integer, auto, calc() or var() |
Example
.dialog { @include z-index(modal); // z-index: var(--nu-z-modal)}.badge { @include z-index(10); // z-index: 10}.dialog { z-index: var(--nu-z-modal);}
.badge { z-index: 10;}z-index-utilities mixinEmits the .z-{key} and .z-{level} classes; with a breakpoint it adds the @breakpoint suffix but does not wrap them in a media query.
@mixin z-index-utilities($breakpoint: null)| Parameter | Type | Default | Description |
|---|---|---|---|
$breakpoint | String|Null | null | Breakpoint name used as the class suffix |
Example
@media (min-width: 768px) { @include z-index-utilities(md);}@media (min-width: 768px) { .z-auto\@md { z-index: auto; } .z-0\@md { z-index: 0; } .z-10\@md { z-index: 10; } .z-20\@md { z-index: 20; } .z-30\@md { z-index: 30; } .z-40\@md { z-index: 40; } .z-50\@md { z-index: 50; } .z-60\@md { z-index: 60; } .z-70\@md { z-index: 70; } .z-80\@md { z-index: 80; } .z-90\@md { z-index: 90; } .z-100\@md { z-index: 100; } .z-200\@md { z-index: 200; } .z-500\@md { z-index: 500; } .z-1000\@md { z-index: 1000; } .z-base\@md { z-index: var(--nu-z-base); } .z-hover\@md { z-index: var(--nu-z-hover); } .z-dropdown\@md { z-index: var(--nu-z-dropdown); } .z-sticky\@md { z-index: var(--nu-z-sticky); } .z-fixed\@md { z-index: var(--nu-z-fixed); } .z-overlay\@md { z-index: var(--nu-z-overlay); } .z-drawer\@md { z-index: var(--nu-z-drawer); } .z-modal\@md { z-index: var(--nu-z-modal); } .z-popover\@md { z-index: var(--nu-z-popover); } .z-tooltip\@md { z-index: var(--nu-z-tooltip); } .z-toast\@md { z-index: var(--nu-z-toast); } .z-max\@md { z-index: var(--nu-z-max); }}z-base mixinSets z-index to the base level token.
@mixin z-basez-index: var(--nu-z-base)Example
.content { @include z-base;}.content { z-index: var(--nu-z-base);}z-hover mixinSets z-index to the hover level token.
@mixin z-hoverz-index: var(--nu-z-hover)Example
.card { @include z-hover;}.card { z-index: var(--nu-z-hover);}z-dropdown mixinSets z-index to the dropdown level token.
@mixin z-dropdownz-index: var(--nu-z-dropdown)Example
.dropdown-menu { @include z-dropdown;}.dropdown-menu { z-index: var(--nu-z-dropdown);}z-sticky mixinSets z-index to the sticky level token.
@mixin z-stickyz-index: var(--nu-z-sticky)Example
.table-header { @include z-sticky;}.table-header { z-index: var(--nu-z-sticky);}z-fixed mixinSets z-index to the fixed level token.
@mixin z-fixedz-index: var(--nu-z-fixed)Example
.navbar { @include z-fixed;}.navbar { z-index: var(--nu-z-fixed);}z-drawer mixinSets z-index to the drawer level token.
@mixin z-drawerz-index: var(--nu-z-drawer)Example
.drawer { @include z-drawer;}.drawer { z-index: var(--nu-z-drawer);}z-modal mixinSets z-index to the modal level token.
@mixin z-modalz-index: var(--nu-z-modal)Example
.modal { @include z-modal;}.modal { z-index: var(--nu-z-modal);}z-popover mixinSets z-index to the popover level token.
@mixin z-popoverz-index: var(--nu-z-popover)Example
.popover { @include z-popover;}.popover { z-index: var(--nu-z-popover);}z-tooltip mixinSets z-index to the tooltip level token.
@mixin z-tooltipz-index: var(--nu-z-tooltip)Example
.tooltip { @include z-tooltip;}.tooltip { z-index: var(--nu-z-tooltip);}z-overlay mixinSets z-index to the overlay level token.
@mixin z-overlayz-index: var(--nu-z-overlay)Example
.backdrop { @include z-overlay;}.backdrop { z-index: var(--nu-z-overlay);}z-toast mixinSets z-index to the toast level token.
@mixin z-toastz-index: var(--nu-z-toast)Example
.toast { @include z-toast;}.toast { z-index: var(--nu-z-toast);}z-max mixinSets z-index to the max level token.
@mixin z-maxz-index: var(--nu-z-max)Example
.debug-panel { @include z-max;}.debug-panel { z-index: var(--nu-z-max);}z-auto mixinSets z-index to auto.
@mixin z-autoExample
.card { @include z-auto;}.card { z-index: auto;}