row mixin
Sets flex-direction to row; applies to a flex container.
@mixin rowExample
.toolbar { @include apply(flex, row);}Compiled CSS
.toolbar { display: flex; flex-direction: row;}Flexbox layout system for creating flexible page layouts.
Gap utilities are defined in _spacing.scss.
<div class="flex row between x-center"> <div class="fill-6">Left column (6 of 12 columns)</div> <div class="fill-6">Right column (6 of 12 columns)</div></div>
<div class="flex col@md row@lg"> <!-- Changes direction based on breakpoint --></div>Classes, base:
Direction:
Wrapping:
Alignment:
Child elements (direct children of .flex):
Responsive: all classes support responsive variants using the @breakpoint suffix:
See also the grid layout (layouts/_grid.scss).
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 CSSunder an example to see its output. Guide: Flex. The A to Z index lists every public mixin and function.
row row-reverse col col-reverse wrap nowrap wrap-reverse start end center stretch between around evenly x-start x-end x-center x-stretch x-baseline x-content-start x-content-end x-content-center x-content-between x-content-around x-content-evenly x-content-stretch self-auto self-start self-end self-center self-stretch self-baseline shrink no-shrink shrink-twice fill-full fill-auto grow no-grow grow-only fill
row mixinSets flex-direction to row; applies to a flex container.
@mixin rowExample
.toolbar { @include apply(flex, row);}.toolbar { display: flex; flex-direction: row;}row-reverse mixinSets flex-direction to row-reverse; applies to a flex container.
@mixin row-reverseExample
.toolbar { @include flex; @include row-reverse;}.toolbar { display: flex; flex-direction: row-reverse;}col mixinSets flex-direction to column; applies to a flex container.
@mixin colExample
.stack { @include apply(flex, col, gap(4));}.stack { display: flex; flex-direction: column; gap: var(--wu-space-4);}.stack > * { --wu-gap: var(--wu-space-4);}col-reverse mixinSets flex-direction to column-reverse; applies to a flex container.
@mixin col-reverseExample
.chat-log { @include flex; @include col-reverse;}.chat-log { display: flex; flex-direction: column-reverse;}wrap mixinSets flex-wrap to wrap so items move onto new lines; applies to a flex container.
@mixin wrapExample
.tag-list { @include apply(flex, wrap, gap(2));}.tag-list { display: flex; flex-wrap: wrap; gap: var(--wu-space-2);}.tag-list > * { --wu-gap: var(--wu-space-2);}nowrap mixinSets flex-wrap to nowrap so items stay on one line; applies to a flex container.
@mixin nowrapExample
.tabs { @include flex; @include nowrap;}.tabs { display: flex; flex-wrap: nowrap;}wrap-reverse mixinSets flex-wrap to wrap-reverse so new lines stack in reverse order; applies to a flex container.
@mixin wrap-reverseExample
.tag-list { @include flex; @include wrap-reverse;}.tag-list { display: flex; flex-wrap: wrap-reverse;}start mixinSets justify-content to flex-start, packing items at the start of the main axis.
@mixin startExample
.toolbar { @include apply(flex, start);}.toolbar { display: flex; justify-content: flex-start;}end mixinSets justify-content to flex-end, packing items at the end of the main axis.
@mixin endExample
.actions { @include apply(flex, end, gap(2));}.actions { display: flex; justify-content: flex-end; gap: var(--wu-space-2);}.actions > * { --wu-gap: var(--wu-space-2);}center mixinSets justify-content to center, centering items on the main axis.
@mixin centerExample
.hero { @include apply(flex, center, x-center);}.hero { display: flex; justify-content: center; align-items: center;}stretch mixinMakes the direct children of a flex container share the main axis equally (each child gets flex: 1 1 0%).
Takes no argument; when one child must be wider, give it a fill-{n} or no-grow class.
@mixin stretch& > * { flex: 1 1 0% }Example
.tabs { @include apply(flex, stretch);}.segmented { @include flex; @include stretch; // .segmented > * { flex: 1 1 0% }}.tabs { display: flex;}.tabs > * { flex: 1 1 0%;}
.segmented { display: flex;}.segmented > * { flex: 1 1 0%;}between mixinSets justify-content to space-between, spreading items with the free space between them.
@mixin betweenExample
.header { @include apply(flex, between, x-center);}.header { display: flex; justify-content: space-between; align-items: center;}around mixinSets justify-content to space-around, giving each item equal space on both sides.
@mixin aroundExample
.nav { @include flex; @include around;}.nav { display: flex; justify-content: space-around;}evenly mixinSets justify-content to space-evenly, making every gap between and around items equal.
@mixin evenlyExample
.stats { @include flex; @include evenly;}.stats { display: flex; justify-content: space-evenly;}x-start mixinSets align-items to flex-start, aligning items to the start of the cross axis.
@mixin x-startExample
.media { @include apply(flex, x-start, gap(4));}.media { display: flex; align-items: flex-start; gap: var(--wu-space-4);}.media > * { --wu-gap: var(--wu-space-4);}x-end mixinSets align-items to flex-end, aligning items to the end of the cross axis.
@mixin x-endExample
.bars { @include flex; @include x-end;}.bars { display: flex; align-items: flex-end;}x-center mixinSets align-items to center, centering items on the cross axis.
@mixin x-centerExample
.header { @include apply(flex, between, x-center);}.header { display: flex; justify-content: space-between; align-items: center;}x-stretch mixinSets align-items to stretch, stretching items to fill the cross axis.
@mixin x-stretchExample
.columns { @include flex; @include x-stretch;}.columns { display: flex; align-items: stretch;}x-baseline mixinSets align-items to baseline, aligning items along their text baseline.
@mixin x-baselineExample
.price-row { @include apply(flex, x-baseline, gap(2));}.price-row { display: flex; align-items: baseline; gap: var(--wu-space-2);}.price-row > * { --wu-gap: var(--wu-space-2);}x-content-start mixinSets align-content to flex-start, packing wrapped lines at the start of the cross axis.
@mixin x-content-startExample
.tag-list { @include apply(flex, wrap, x-content-start);}.tag-list { display: flex; flex-wrap: wrap; align-content: flex-start;}x-content-end mixinSets align-content to flex-end, packing wrapped lines at the end of the cross axis.
@mixin x-content-endExample
.tag-list { @include apply(flex, wrap, x-content-end);}.tag-list { display: flex; flex-wrap: wrap; align-content: flex-end;}x-content-center mixinSets align-content to center, centering wrapped lines on the cross axis.
@mixin x-content-centerExample
.gallery { @include apply(flex, wrap, x-content-center);}.gallery { display: flex; flex-wrap: wrap; align-content: center;}x-content-between mixinSets align-content to space-between, spreading wrapped lines with the free space between them.
@mixin x-content-betweenExample
.gallery { @include apply(flex, wrap, x-content-between);}.gallery { display: flex; flex-wrap: wrap; align-content: space-between;}x-content-around mixinSets align-content to space-around, giving each wrapped line equal space on both sides.
@mixin x-content-aroundExample
.gallery { @include apply(flex, wrap, x-content-around);}.gallery { display: flex; flex-wrap: wrap; align-content: space-around;}x-content-evenly mixinSets align-content to space-evenly, making every gap between and around wrapped lines equal.
@mixin x-content-evenlyExample
.gallery { @include apply(flex, wrap, x-content-evenly);}.gallery { display: flex; flex-wrap: wrap; align-content: space-evenly;}x-content-stretch mixinSets align-content to stretch, stretching wrapped lines to fill the cross axis.
@mixin x-content-stretchExample
.gallery { @include apply(flex, wrap, x-content-stretch);}.gallery { display: flex; flex-wrap: wrap; align-content: stretch;}self-auto mixinSets align-self to auto, so the item follows the container's align-items.
@mixin self-autoExample
.item { @include self-auto;}.item { align-self: auto;}self-start mixinSets align-self to flex-start, aligning this item to the start of the cross axis.
@mixin self-startExample
.badge { @include self-start;}.badge { align-self: flex-start;}self-end mixinSets align-self to flex-end, aligning this item to the end of the cross axis.
@mixin self-endExample
.timestamp { @include self-end;}.timestamp { align-self: flex-end;}self-center mixinSets align-self to center, centering this item on the cross axis.
@mixin self-centerExample
.icon { @include self-center;}.icon { align-self: center;}self-stretch mixinSets align-self to stretch, stretching this item to fill the cross axis.
@mixin self-stretchExample
.divider { @include self-stretch;}.divider { align-self: stretch;}self-baseline mixinSets align-self to baseline, aligning this item along the text baseline.
@mixin self-baselineExample
.label { @include self-baseline;}.label { align-self: baseline;}shrink mixinSets flex-shrink to 1 so the item can shrink when space runs out.
@mixin shrinkExample
.title { @include apply(shrink, truncate);}.title { flex-shrink: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}no-shrink mixinSets flex-shrink to 0 so the item never shrinks below its size.
@mixin no-shrinkExample
.avatar { @include apply(no-shrink, width(10));}.avatar { flex-shrink: 0; width: var(--wu-space-10);}shrink-twice mixinSets flex-shrink to 2 so the item shrinks twice as fast as items with flex-shrink 1.
@mixin shrink-twiceExample
.sidebar { @include shrink-twice;}.sidebar { flex-shrink: 2;}fill-full mixinSets flex to 0 0 100% so the item takes a full row and neither grows nor shrinks.
@mixin fill-fullExample
.banner { @include fill-full;}.banner { flex: 0 0 100%;}fill-auto mixinSets flex to 1 1 auto so the item starts at its content size, then grows and shrinks.
@mixin fill-autoExample
.search { @include fill-auto;}.search { flex: 1 1 auto;}grow mixinSets flex to 1 1 0% so the item grows and shrinks from a zero base, sharing space equally with other grow items.
@mixin growExample
.main { @include grow;}.main { flex: 1 1 0%;}no-grow mixinSets flex to none so the item keeps its size and neither grows nor shrinks.
@mixin no-growExample
.logo { @include no-grow;}.logo { flex: none;}grow-only mixinSets flex to 1 0 auto so the item grows from its content size but never shrinks.
@mixin grow-onlyExample
.content { @include grow-only;}.content { flex: 1 0 auto;}fill mixinSizes a flex child to span a number of columns out of $column-count (12 by default), subtracting the container gap from --wu-gap.
Gap mixins set --wu-gap on direct children, so place the item directly inside the gap container; without a gap it reads the registered initial value 0px.
@mixin fill($size)| Parameter | Type | Default | Description |
|---|---|---|---|
$size | Number | Required | Whole number of columns to span, from 1 to $column-count; a fraction, 0, a negative number, more than $column-count, a value with a unit or a non-number raises an error |
flex: 0 0 <width>; max-width: <width>; min-width: 0, where width is a calc() over 100% and var(--wu-gap)Example
.sidebar { @include fill(4); // one third of the row, minus its share of the gap}.layout { @include apply(flex, gap(4)); > .main { @include fill(8); }}.sidebar { flex: 0 0 calc((100% - 2 * var(--wu-gap)) / 3); max-width: calc((100% - 2 * var(--wu-gap)) / 3); min-width: 0;}
.layout { display: flex; gap: var(--wu-space-4);}.layout > * { --wu-gap: var(--wu-space-4);}.layout > .main { flex: 0 0 calc((100% - 0.5 * var(--wu-gap)) / 1.5); max-width: calc((100% - 0.5 * var(--wu-gap)) / 1.5); min-width: 0;}