Stack
Stack is a layout component that facilitates the vertical or horizontal organization of elements by applying consistent spacing between them. Its main goal is to simplify the alignment of items in a row or column without needing to write additional styles for spacing.
Basic Usage
Use the is-stack
class. It automatically generates a vertical organization and a spacing of 0.5 rem.
<div class="is-stack">
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
</div>
Directions
Use the following classes to define the direction, and the elements will always align to the center.
If you need the elements to align to the start or end, you can use the flex helper classes.
Vertical
Use the is-vstack
class to organize elements vertically.
- Preview
- Code
<div class="is-vstack is-color-white" style="max-width:400px">
<div class="is-bg-primary p-3 is-rounded-2" style="width:80%"></div>
<div class="is-bg-info p-3 is-rounded-2" style="width:30%"></div>
<div class="is-bg-primary p-3 is-rounded-2" style="width:50%"></div>
</div>
Horizontal
Use the is-hstack
class to organize elements horizontally.
- Preview
- Code
<div class="is-hstack is-color-white" style="max-width:400px;height:120px">
<div class="is-bg-primary p-3 is-rounded-2 w-100" style="height:100%"></div>
<div class="is-bg-info p-3 is-rounded-2 w-100" style="height:30%"></div>
<div class="is-bg-primary p-3 is-rounded-2 w-100" style="height:50%"></div>
</div>
Spacing
Use is-gap-{size}
to add space between flex items. The size is a value between 0
and 6
.
For more information on spacing values, visit the customize spacing documentation.
- Preview
- Code
Gap: 4
Gap: 2
<div class="is-stack">
<h5>Gap: 4</h5>
<div class="is-stack is-gap-4 is-color-white">
<div class="is-bg-primary p-3 is-rounded-2">Item 1</div>
<div class="is-bg-info p-3 is-rounded-2">Item 2</div>
<div class="is-bg-primary p-3 is-rounded-2">Item 3</div>
</div>
<h5>Gap: 2</h5>
<div class="is-stack is-gap-2 is-color-white">
<div class="is-bg-primary p-3 is-rounded-2">Item 1</div>
<div class="is-bg-info p-3 is-rounded-2">Item 2</div>
<div class="is-bg-primary p-3 is-rounded-2">Item 3</div>
</div>
</div>