1-column layout is applied by default for the following breakpoints: xsmall, small and medium.
2 or 3-column layout can be used for higher resolution breakpoints: large, xlarge and xxlarge.
On the 1-column layout, the grid columns are stacked vertically and full width.
The BEM class syntax is the following (breakpoint and property are optional):
<!-- By default, one column will stretch and fill the full width -->
<div class="ui-row">
<div class="ui-col"> ... </div>
</div>
1/3 on one side and 2/3 on other side (and vice-versa)
<!-- 1/3 on left side and 2/3 on right side -->
<!-- these sizes only start to take effect at breakpoint "large" and above -->
<div class="ui-row">
<div class="ui-col ui-col--1-3"> ... </div>
<div class="ui-col ui-col--2-3"> ... </div>
</div>
<!-- vice versa -->
<div class="ui-row">
<div class="ui-col ui-col--2-3"> ... </div>
<div class="ui-col ui-col--1-3"> ... </div>
</div>
Equal size columns (unless content forces columns to expand)
<!-- Grid columns (without modifier classes) will be of equal size -->
<!-- If the content is too big, the grid columns will re-adjust to allow the content to fit as best as possible -->
<!-- To force colum width, use modifier classes like "--1-2" or "--1-3" -->
<div class="ui-row">
<div class="ui-col"> ... </div>
<div class="ui-col"> ... </div>
<div class="ui-col"> ... </div>
</div>
1/8 on one side and 7/8 on other side and some other examples
<!-- 1/8 on left side and 7/8 on right side -->
<div class="ui-row">
<div class="ui-col ui-col--1-8"> ... </div>
<div class="ui-col ui-col--7-8"> ... </div>
</div>
<!-- 2/6 on left side, 1/6 in the middle and 3/6 on right side -->
<div class="ui-row">
<div class="ui-col ui-col--2-6"> ... </div>
<div class="ui-col ui-col--1-6"> ... </div>
<div class="ui-col ui-col--3-6"> ... </div>
</div>
Force a column to take as little space as possible, and let other columns fill the remaining space.
<!-- column 1 will shrink to fit its content -->
<!-- column 2 will take 1/3 of the space -->
<!-- column 3 will fill the remaining space available -->
<div class="ui-row">
<div class="ui-col ui-col--shrink"> ... </div>
<div class="ui-col ui-col--1-3"> ... </div>
<div class="ui-col"> ... </div>
</div>
Using flexbox order property, we can re-order columns to new position, different from their original position in the DOM. The most common scenario will be to push/pull columns to go first or last. If even more control is required, columns can be re-organised using a number from 1 to 12.
Remember that columns without re-order value will keep their default value of 0. If a column is set to be order 1, it will still appear AFTER columns with no specific re-ordering.
<!-- Re-order first/last -->
<div class="ui-row">
<div class="ui-col ui-col--order-last"> Will be displayed last in the row </div>
<div class="ui-col"> ... </div>
<div class="ui-col"> ... </div>
</div>
<!-- Re-order to specific # position -->
<div class="ui-row">
<!-- in that scenario, the 2 columns without re-ordering will move to the start of the row -->
<!-- ui-col--order-1 does NOT supersede normal columns, only other re-order columns, ex: order-2 or 3 -->
<div class="ui-col ui-col--order-last"> last in the row </div>
<div class="ui-col"> will remain in position 0 (default) </div>
<div class="ui-col ui-col--order-3"> position 3 </div>
<div class="ui-col ui-col--order-2"> position 2 </div>
<div class="ui-col ui-col--order-1"> position 1 </div>
</div>
Remove the padding for all columns
<!-- No gutters -->
<div class="ui-row ui-row--no-gutters">...</div>
By default, all columns of a row will be aligned top. This can be set to center or bottom using pre-defined classes. It's possible to force a particular column to be aligned differently from the other columns in the row.
<!-- Aligned top -->
<!-- By default, all columns are aligned at the top (no modifier class required) -->
<div class="ui-row">...</div>
<div class="ui-row ui-row--top">...</div>
<!-- Aligned center -->
<div class="ui-row ui-row--center">...</div>
<!-- Aligned bottom -->
<div class="ui-row ui-row--bottom">...</div>
<!-- Mixed alignment -->
<!-- By default, the grid is aligned at the top, but we can force specific column(s) to align differently -->
<div class="ui-row">
<div class="ui-col"> ... </div>
<div class="ui-col"> ... </div>
<div class="ui-col ui-col--bottom"> ... </div>
</div>
<!-- text alignment within grid column -->
<div class="ui-row">
<div class="ui-col ui-col--align-left"> ... </div>
<div class="ui-col ui-col--align-center"> ... </div>
<div class="ui-col ui-col--align-right"> ... </div>
</div>
If the columns width defined exceeds the normal row width, columns will wrap on new lines automatically.
<!-- Columns in the same row will wrap if they have modifier classes that force a specific width -->
<!-- For example, 1 full width column followed by columns 1/3 and 2/3... -->
<div class="ui-row">
<div class="ui-col ui-col--full"> ... </div>
<div class="ui-col ui-col--1-3"> ... </div>
<div class="ui-col ui-col--2-3"> ... </div>
<div class="ui-col ui-col--1-2"> ... </div>
</div>
More complex layout can be achieve using nested grids.
<!-- Top-level row -->
<div class="ui-row">
<!-- This grid column is a "parent" to another nested grid -->
<div class="ui-col ui-col--parent">
<!-- 2nd level nested grid starts here -->
<div class="ui-row">
<div class="ui-col ui-col--full"> ... </div>
<div class="ui-col"> ... </div>
<div class="ui-col"> ... </div>
</div>
</div>
<div class="ui-col ui-col--1-3"> ... </div>
</div>
By default, the grid column width is set for all breakpoints. Column size can also be set for specific breakpoints, using mobile-first approach.
<!-- Columns in the same row will wrap if they have modifier classes that force a specific width -->
<!-- For example, 1 full width column followed by columns 1/3 and 2/3... -->
<div class="ui-row">
<div class="ui-col ui-col--xsmall--1-2 ui-col--small--full ui-col--medium--1-3"> ... </div>
<div class="ui-col ui-col--xsmall--1-2 ui-col--small--full ui-col--medium--2-3"> ... </div>
<div class="ui-col ui-col--1-2 ui-col--xlarge--2-3"> ... </div>
<div class="ui-col ui-col--1-2 ui-col--xlarge--1-3"> ... </div>
</div>
<!-- if "shrink" is used on smaller breakpoints, "expand" should be used on other columns in the same row -->
<!-- without "expand" those columns would default to 100% width (until breakpoint large is reached) -->
<div class="ui-row">
<div class="ui-col ui-col--xsmall--shrink ui-col--medium--1-2"> ... </div>
<div class="ui-col ui-col--xsmall--expand ui-col--medium--1-2"> ... </div>
</div>