Skip to content

Flex

Flexbox layout mixin for stacking elements.

stack()

Creates a flexbox container for stacking elements with customizable alignment and spacing.

ParameterTypeDefault ValueDescription
$orientationstring"horizontal"The stack orientation (horizontal, vertical)
$alignXstring"center"X-axis alignment (left, right, center, stretch, space-around, space-between, space-evenly)
$alignYstring"center"Y-axis alignment (top, bottom, center, stretch, space-around, space-between, space-evenly)
$gapnumber$stack-gapThe gap between elements
$wrapbooleantrueWhether elements can wrap to multiple lines
$var-prefixstring"stack"The CSS variable prefix
scss
.container {
    @include stack(horizontal, center, center, 20px);
}
css
.container {
    display: var(--stack-display, flex);
    align-items: var(--stack-align, center);
    justify-content: var(--stack-justify, center);
    flex-direction: var(--stack-direction, row);
    column-gap: var(--stack-col-gap, var(--stack-gap, 20px));
    row-gap: var(--stack-row-gap, var(--stack-gap, 20px));
    flex-wrap: var(--stack-wrap, wrap);
}