Cols
Split multiple HTML nodes in columns.
Each node will have its own column, and every column will take by default a proportional slice of the full available width. On mobile, the elements will be stacked by default anyway.
Use this component when you want to present multiple items distributed by column, such as a side by side comparison. Do not use this component if you need to reflow elements, or if you want precise positioning of the elements. That is the job of the GsStack element.
Usage
To define cols, use the GsCols component class:
<div class="GsCols">
<div>Node</div>
<div>Node</div>
<div>Node</div>
<div>Node</div>
</div>
Force columns
By default, cols are rendered as a vertical stack on mobile, where space is limited and columns may
not fill well. But if you really want to always use columns, even on mobile, add the --force
modifier to your GsCols element.
<div class="GsCols GsCols--force">
<div class="box">1</div>
<div class="box">2</div>
</div>
Resize your browser to a smaller viewport and notice how this example doesn’t break into a vertical stack when the viewport is too thin.
Fit element
Use the GsCols__fit class on a direct child to opt it out of taking a proportional width. Combine
with other modifiers or classes to create layouts such as sidebars.
<div class="GsCols">
<div class="box GsCols__fit">Filters</div>
<div class="box">Results</div>
</div>
Reverse
Use the GsCols--reverse modifier in the GsCols container to reverse the order of the columns.
<div class="GsCols GsCols--reverse">
<div>Node</div>
<div>Node</div>
<div>Node</div>
<div>Node</div>
</div>
This only affects the responsive mode on larger breakpoints (or when the --force modifier is in
use). The mobile stack view will keep the semantic order of elements.
Gap size
This component respects the GsGap modifier.