Controls element margins, padding, gaps, and spacing between children.
Responsive: all spacing classes support responsive variants using the @breakpoint suffix:
Spacing values are defined in the $spacings map in config/_spacing.scss; each key is emitted as a --wu-space-{key} token. Typically follows a scale where higher numbers mean more spacing.
See also: flex, grid, display.
Generated from the doc blocks in the core source when the site is built, so it always matches the current release of @wovenui/core. Every example is compiled against core during the build; open Compiled CSS under an example to see its output. Guide: Spacing . The A to Z index lists every public mixin and function.
Mixins 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 mixin Sets padding on all sides from a spacing key or a raw value.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key (4 gives var(--wu-space-4)), or a value with a unit, calc() or var(); negative keys and auto raise an error
Example 1
@include p ( 4 ) ; // padding: var(--wu-space-4)
Compiled CSS padding : var ( --wu-space-4 );
Example 2
@include p ( 1.5 rem ) ; // padding: 1.5rem
Compiled CSS padding on MDN
See also: px , py , pt , ps . Source: utilities/_spacing.scss:142
px mixin Sets padding on the inline start and end (padding-inline), following text direction.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key (4 gives var(--wu-space-4)), or a value with a unit, calc() or var(); negative keys and auto raise an error
Example 1
@include px ( 4 ) ; // padding-inline: var(--wu-space-4)
Compiled CSS padding-inline : var ( --wu-space-4 );
Example 2
@include apply ( px ( 2 ), py ( 1 ) ) ;
Compiled CSS padding-inline : var ( --wu-space-2 );
padding-block : var ( --wu-space-1 );
padding-inline on MDN
See also: py , ps , pe . Source: utilities/_spacing.scss:160
py mixin Sets padding on the block start and end (padding-block), top and bottom in horizontal writing modes.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key (4 gives var(--wu-space-4)), or a value with a unit, calc() or var(); negative keys and auto raise an error
Example 1
@include py ( 2 ) ; // padding-block: var(--wu-space-2)
Compiled CSS padding-block : var ( --wu-space-2 );
Example 2
@include py ( 0.625 rem ) ; // padding-block: 0.625rem
Compiled CSS padding-block on MDN
See also: px , pt , pb . Source: utilities/_spacing.scss:178
pt mixin Sets padding-top from a spacing key or a raw value.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key (4 gives var(--wu-space-4)), or a value with a unit, calc() or var(); negative keys and auto raise an error
Example 1
@include pt ( 4 ) ; // padding-top: var(--wu-space-4)
Compiled CSS padding-top : var ( --wu-space-4 );
Example 2
@include pt ( 1.5 rem ) ; // padding-top: 1.5rem
Compiled CSS padding-top on MDN
See also: pb , py . Source: utilities/_spacing.scss:195
pr mixin Sets padding-right (physical, does not follow text direction) from a spacing key or a raw value.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key (4 gives var(--wu-space-4)), or a value with a unit, calc() or var(); negative keys and auto raise an error
Example 1
@include pr ( 4 ) ; // padding-right: var(--wu-space-4)
Compiled CSS padding-right : var ( --wu-space-4 );
Example 2
@include pr ( 1.5 rem ) ; // padding-right: 1.5rem
Compiled CSS padding-right on MDN
See also: pe , pl . Source: utilities/_spacing.scss:212
pb mixin Sets padding-bottom from a spacing key or a raw value.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key (4 gives var(--wu-space-4)), or a value with a unit, calc() or var(); negative keys and auto raise an error
Example 1
@include pb ( 4 ) ; // padding-bottom: var(--wu-space-4)
Compiled CSS padding-bottom : var ( --wu-space-4 );
Example 2
@include pb ( 1.5 rem ) ; // padding-bottom: 1.5rem
Compiled CSS padding-bottom on MDN
See also: pt , py . Source: utilities/_spacing.scss:229
pl mixin Sets padding-left (physical, does not follow text direction) from a spacing key or a raw value.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key (4 gives var(--wu-space-4)), or a value with a unit, calc() or var(); negative keys and auto raise an error
Example 1
@include pl ( 4 ) ; // padding-left: var(--wu-space-4)
Compiled CSS padding-left : var ( --wu-space-4 );
Example 2
@include pl ( 1.5 rem ) ; // padding-left: 1.5rem
Compiled CSS padding-left on MDN
See also: ps , pr . Source: utilities/_spacing.scss:246
ps mixin Sets padding-inline-start (left in LTR, right in RTL) from a spacing key or a raw value.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key (4 gives var(--wu-space-4)), or a value with a unit, calc() or var(); negative keys and auto raise an error
Example 1
@include ps ( 4 ) ; // padding-inline-start: var(--wu-space-4)
Compiled CSS padding-inline-start : var ( --wu-space-4 );
Example 2
@include ps ( 1.5 rem ) ; // padding-inline-start: 1.5rem
Compiled CSS padding-inline-start : 1.5 rem ;
padding-inline-start on MDN
See also: pe , px , pl . Source: utilities/_spacing.scss:264
pe mixin Sets padding-inline-end (right in LTR, left in RTL) from a spacing key or a raw value.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key (4 gives var(--wu-space-4)), or a value with a unit, calc() or var(); negative keys and auto raise an error
Example 1
@include pe ( 4 ) ; // padding-inline-end: var(--wu-space-4)
Compiled CSS padding-inline-end : var ( --wu-space-4 );
Example 2
@include pe ( 1.5 rem ) ; // padding-inline-end: 1.5rem
Compiled CSS padding-inline-end : 1.5 rem ;
padding-inline-end on MDN
See also: ps , px , pr . Source: utilities/_spacing.scss:282
m mixin Sets margin on all sides from a spacing key, a negative key, auto or a raw value.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key (4 gives var(--wu-space-4)), a negative key, auto, or a value with a unit, calc() or var()
Example 1
@include m ( 4 ) ; // margin: var(--wu-space-4)
Compiled CSS margin : var ( --wu-space-4 );
Example 2
@include m ( -2 ) ; // margin: calc(-1 * var(--wu-space-2))
Compiled CSS margin : calc ( -1 * var ( --wu-space-2 ));
margin on MDN
See also: mx , my , mt , ms . Source: utilities/_spacing.scss:303
mx mixin Sets margin on the inline start and end (margin-inline), following text direction.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key (4 gives var(--wu-space-4)), a negative key, auto, or a value with a unit, calc() or var()
Example 1
@include mx ( 4 ) ; // margin-inline: var(--wu-space-4)
Compiled CSS margin-inline : var ( --wu-space-4 );
Example 2
@include mx ( -4 ) ; // margin-inline: calc(-1 * var(--wu-space-4))
Compiled CSS margin-inline : calc ( -1 * var ( --wu-space-4 ));
margin-inline on MDN
See also: mx-auto , my , ms , me . Source: utilities/_spacing.scss:322
my mixin Sets margin on the block start and end (margin-block), top and bottom in horizontal writing modes.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key (4 gives var(--wu-space-4)), a negative key, auto, or a value with a unit, calc() or var()
Example 1
@include my ( 6 ) ; // margin-block: var(--wu-space-6)
Compiled CSS margin-block : var ( --wu-space-6 );
Example 2
@include my ( 1.5 rem ) ; // margin-block: 1.5rem
Compiled CSS margin-block on MDN
See also: mx , mt , mb . Source: utilities/_spacing.scss:340
mt mixin Sets margin-top from a spacing key, a negative key, auto or a raw value.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key (4 gives var(--wu-space-4)), a negative key, auto, or a value with a unit, calc() or var()
Example 1
@include mt ( 4 ) ; // margin-top: var(--wu-space-4)
Compiled CSS margin-top : var ( --wu-space-4 );
Example 2
@include mt ( -2 ) ; // margin-top: calc(-1 * var(--wu-space-2))
Compiled CSS margin-top : calc ( -1 * var ( --wu-space-2 ));
margin-top on MDN
See also: mb , my . Source: utilities/_spacing.scss:357
mr mixin Sets margin-right (physical, does not follow text direction) from a spacing key, a negative key, auto or a raw value.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key (4 gives var(--wu-space-4)), a negative key, auto, or a value with a unit, calc() or var()
Example 1
@include mr ( 4 ) ; // margin-right: var(--wu-space-4)
Compiled CSS margin-right : var ( --wu-space-4 );
Example 2
@include mr ( -2 ) ; // margin-right: calc(-1 * var(--wu-space-2))
Compiled CSS margin-right : calc ( -1 * var ( --wu-space-2 ));
margin-right on MDN
See also: me , ml , mr-auto . Source: utilities/_spacing.scss:375
mb mixin Sets margin-bottom from a spacing key, a negative key, auto or a raw value.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key (4 gives var(--wu-space-4)), a negative key, auto, or a value with a unit, calc() or var()
Example 1
@include mb ( 4 ) ; // margin-bottom: var(--wu-space-4)
Compiled CSS margin-bottom : var ( --wu-space-4 );
Example 2
@include mb ( -2 ) ; // margin-bottom: calc(-1 * var(--wu-space-2))
Compiled CSS margin-bottom : calc ( -1 * var ( --wu-space-2 ));
margin-bottom on MDN
See also: mt , my . Source: utilities/_spacing.scss:392
ml mixin Sets margin-left (physical, does not follow text direction) from a spacing key, a negative key, auto or a raw value.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key (4 gives var(--wu-space-4)), a negative key, auto, or a value with a unit, calc() or var()
Example 1
@include ml ( 4 ) ; // margin-left: var(--wu-space-4)
Compiled CSS margin-left : var ( --wu-space-4 );
Example 2
@include ml ( -2 ) ; // margin-left: calc(-1 * var(--wu-space-2))
Compiled CSS margin-left : calc ( -1 * var ( --wu-space-2 ));
margin-left on MDN
See also: ms , mr , ml-auto . Source: utilities/_spacing.scss:410
ms mixin Sets margin-inline-start (left in LTR, right in RTL) from a spacing key, a negative key, auto or a raw value.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key (4 gives var(--wu-space-4)), a negative key, auto, or a value with a unit, calc() or var()
Example 1
@include ms ( 4 ) ; // margin-inline-start: var(--wu-space-4)
Compiled CSS margin-inline-start : var ( --wu-space-4 );
Example 2
@include ms ( -2 ) ; // margin-inline-start: calc(-1 * var(--wu-space-2))
Compiled CSS margin-inline-start : calc ( -1 * var ( --wu-space-2 ));
margin-inline-start on MDN
See also: me , mx , ms-auto . Source: utilities/_spacing.scss:428
me mixin Sets margin-inline-end (right in LTR, left in RTL) from a spacing key, a negative key, auto or a raw value.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key (4 gives var(--wu-space-4)), a negative key, auto, or a value with a unit, calc() or var()
Example 1
@include me ( 4 ) ; // margin-inline-end: var(--wu-space-4)
Compiled CSS margin-inline-end : var ( --wu-space-4 );
Example 2
@include me ( -2 ) ; // margin-inline-end: calc(-1 * var(--wu-space-2))
Compiled CSS margin-inline-end : calc ( -1 * var ( --wu-space-2 ));
margin-inline-end on MDN
See also: ms , mx , me-auto . Source: utilities/_spacing.scss:446
ml-auto mixin Sets margin-left to auto (physical), pushing the element to the right in a flex row.
Example
@include ml-auto ; // margin-left: auto
Compiled CSS margin-left on MDN
See also: ms-auto , mr-auto . Source: utilities/_spacing.scss:458
mr-auto mixin Sets margin-right to auto (physical), pushing the element to the left in a flex row.
Example
@include mr-auto ; // margin-right: auto
Compiled CSS margin-right on MDN
See also: me-auto , ml-auto . Source: utilities/_spacing.scss:470
ms-auto mixin Sets margin-inline-start to auto, pushing the element to the inline end in a flex row.
Example
@include ms-auto ; // margin-inline-start: auto
Compiled CSS margin-inline-start : auto ;
margin-inline-start on MDN
See also: me-auto , ml-auto . Source: utilities/_spacing.scss:482
me-auto mixin Sets margin-inline-end to auto, pushing the element to the inline start in a flex row.
Example
@include me-auto ; // margin-inline-end: auto
Compiled CSS margin-inline-end on MDN
See also: ms-auto , mr-auto . Source: utilities/_spacing.scss:494
mx-auto mixin Centers a block element on the inline axis with margin-inline: auto.
Example
@include apply ( max-width ( 64 rem ), mx - auto ) ;
Compiled CSS margin-inline on MDN
See also: mx , ms-auto , me-auto . Source: utilities/_spacing.scss:507
space-y mixin Adds margin-block-start to every direct child after the first, spacing children along the block axis (vertically in horizontal writing modes).
Parameter Type Default Description $iNumber|Length|Calculation|StringRequired Spacing key, a negative key, or a value with a unit, calc() or var()
Example
@include space-y ( 4 ) ; // .stack > * + * { margin-block-start: var(--wu-space-4) }
Compiled CSS margin-block-start : var ( --wu-space-4 );
See also: space-x , gap . Source: utilities/_spacing.scss:521
space-x mixin Adds margin-inline-start to every direct child after the first, spacing children along the inline axis.
Parameter Type Default Description $iNumber|Length|Calculation|StringRequired Spacing key, a negative key, or a value with a unit, calc() or var()
Example
@include space-x ( 2 ) ; // .toolbar > * + * { margin-inline-start: var(--wu-space-2) }
Compiled CSS margin-inline-start : var ( --wu-space-2 );
See also: space-y , gap-x . Source: utilities/_spacing.scss:535
gap mixin Sets gap on a flex or grid container and passes it to direct children as --wu-gap for fill() widths.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key, normal, or a value with a unit, calc() or var(); negative keys raise an error
Example 1
@include gap ( 4 ) ; // gap: var(--wu-space-4)
Compiled CSS --wu-gap : var ( --wu-space-4 );
Example 2
@include apply ( flex , gap ( 1.25 rem ) ) ;
Compiled CSS See also: gap-x , gap-y , space-x . Source: utilities/_spacing.scss:564
gap-x mixin Sets column-gap on a flex or grid container and passes it to direct children as --wu-gap for fill() widths.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key, normal, or a value with a unit, calc() or var(); negative keys raise an error
Example
@include gap-x ( 6 ) ; // column-gap: var(--wu-space-6)
Compiled CSS column-gap : var ( --wu-space-6 );
--wu-gap : var ( --wu-space-6 );
See also: gap , gap-y . Source: utilities/_spacing.scss:582
gap-y mixin Sets row-gap on a flex or grid container; --wu-gap is not set because it only feeds inline widths.
Parameter Type Default Description $valNumber|Length|Calculation|StringRequired Spacing key, normal, or a value with a unit, calc() or var(); negative keys raise an error
Example
@include gap-y ( 2 ) ; // row-gap: var(--wu-space-2)
Compiled CSS row-gap : var ( --wu-space-2 );
row-gap on MDN
See also: gap , gap-x . Source: utilities/_spacing.scss:601