NIO Grid system

Use our powerful mobile-first flexbox grid to build layouts of all shapes and sizes thanks to a twelve column system, 4 default responsive tiers, Sass variables and mixins.


How it works

NIO grid system uses a series of containers, rows, and columns to layout and align content. It’s built with flexbox and is fully responsive. Below is an example and an in-depth look at how the grid comes together.


col 1
col 2
col 3

<div class="niogrid-container-grid">
  <div class="niogrid-row">
    <div class="niogrid-col-4">
      One of three columns
    </div>
    <div class="niogrid-col-4">
      One of three columns
    </div>
    <div class="niogrid-col-4">
      One of three columns
    </div>
  </div>
</div>

The above example creates three equal-width columns on small, medium, large, and extra large devices using our predefined grid classes. Those columns are centered in the page with the parent .niogrid-container-grid.


Grid options

pxs are used for grid breakpoints and container widths. This is because the viewport width is in pixels and does not change with the font size.


General
Apply to all viewport
Small
≤719px
Medium
≤1279px
Large
≤1439px
Extra large
>=1440px
Max container widStyledThAuto with viewport343px640px1200px1280px
Class prefix.niogrid-col-.niogrid-col-sm-.niogrid-col-md-.niogrid-col-lg-.niogrid-col-xl-
# of columns12
Gutter width20px40px

Nesting

To nest your content with the default grid, add a new .row and set of .niogrid-col-* columns within an existing .niogrid-col-* column. Nested rows should include a set of columns that add up to 12 or fewer (it is not required that you use all 12 available columns).


Level 1: .niogrid-col-11
Level 2: .niogrid-col-6
Level 2: .niogrid-col-5

<div class="niogrid-row">
    <div class="col-9">
        Level 1: .col-9
        <div class="niogrid-row">
            <div class="niogrid-col-4">
                Level 2: .col-4
            </div>

            <div class="niogrid-col-5">
                Level 2: .col-5
            </div>
        </div>
    </div>
</div>

Offset classes

Move columns to the right using .niogrid-offset-md-* classes. These classes increase the left margin of a column by * columns. For example, .niogrid-offset-md-3 moves .col-md-3 over four columns. Like cols, we have basic offsets for all viewport and 3 offset for corresponding viewports. Below is a basic example of basic offset.


without offset

with 3 column offset

with 6 column offset

<div class="niogrid-row">
    <div class="niogrid-col-6" >
        without offset
    </div>
</div>

<div class="niogrid-row">
    <div class="niogrid-col-6 niogrid-offset-3">
        with 3 column offset
    </div>
</div>

<div class="niogrid-row">
    <div class="niogrid-col-6 niogrid-offset-6" >
        with 6 column offset
    </div>
</div>

General
Apply to all viewport
Small
≤719px
Medium
≤1279px
Large
≤1439px
Extra large
>=1440px
Max container widStyledThAuto with viewport343px640px1200px1280px
Class prefix.niogrid-offset-.niogrid-offset-sm-.niogrid-offset-md-.niogrid-offset-lg-.niogrid-offset-xl-

Margins

There are four margin unit vars we can use in the code base and here is an example down below:

$sm-margin: 30.25px;
$md-margin: 55px;
$lg-margin: 101.67px;
$xl-margin: 110px;

3
3
3

<div className="niogrid-row" style={{ margin: '0 $xl-margin' }}>
    <div className="niogrid-col-3">
        3
    </div>
    <div className="niogrid-col-3">
        3
    </div>
    <div className="niogrid-col-3">
        3
    </div>
</div>

Mobile examples

In some situations, we may only have two columns on mobile design. In this case, we can use niogrid-col-sm-6 to separate it into two parts


mobile left
mobile right

<div class="niogrid-row">
    <div class="niogrid-col-sm-6">
        mobile left
    </div>

    <div class="niogrid-col-sm-6">
        mobile right
    </div>
</div>

Each one of this represent one column under different viewports. We can normally use those values to adjust or center element. Those vars can be use in nested situations too since they are static value under specific viewport.
A
B
C
D
E
F
G
H
I
J
H
I