Jump To:

  1. Options
  2. Examples
    1. Default Grid
    2. Justify Content
    3. Align
    4. gutters
    5. gutters-row
    6. gutter-scale
    7. rules-row
    8. rules-row-align
    9. rules-column
    10. item width
    11. item offset

Data grid

Flexbox based grid that uses a JSON like attribute for options


The grid is for page layout, it provides different column sizes at each of the configured breakpoints.

On the smallest size the grid columns will span 100%. The grid is setup using two attributes, data-grid="" for the parent grid container and data-grid-item="" for each grid column. The grid uses a script to set position classes, which are used for rule placement since the grid and reflow at different breakpoints.

Options

Options for 'data-grid'
Option Value Description/Example
columns 12

Number of columns for grid, must match grids that are setup in site. For most projects this is just '12'. This is set up this way to allow mutliple grids.

<div data-grid="columns: 12">...

justify (center|end)

Allows you to justify the columns (horizontal alignment). The defualt is start (left aligned)

<div data-grid="..., justify: center">...

align (center|start|end|stretch-end|stretch-center)

Allows you to align the columns (vertical alignment within row). The defualt is stretch start. Note using stretch-end or stretch-center will stretch all columns to be the same height but will align the columns content to the end or center.

<div data-grid="..., align: center">...

gutters false

You can remove the gutters between columns by adding this setting. The grid shows the default gutters size by default.

<div data-grid="..., gutters: false">...

gutters-row (true|top|bottom|fit)

If set to 'top' gutters will be between items starting at the top including the first row (so it makes space above the first grid row. Bottom works the same way but on the bottom. True adds gutters between rows and to the top and bottom of the first/last grid row. Fit will only put gutters between the rows.

<div data-grid="..., gutters-row: true">...

gutter-scale [scale key]

No alternated scales are configured for this site. Allows for different gutter scales to be used with grid. Requires setting up the scales when you configure/create the grid.

<div data-grid="..., gutter-scale: large">...

rules-row (top|bottom|between)

Sets rules (dividers) between rows. Top adds rules to the rows top edge. Bottom adds rules to the rows bottom edge. Between adds rules between rows but not on top or bottom.

<div data-grid="..., rules-row: true">...

rules-row-style [style key]

If alternate rule styles are configured, applies them by the key that was used to configure the alternate style when initializing the grid in SCSS.

<div data-grid="..., rules-row-style: light">...

rules-row-align (gutter)

The default (without this set), will align to the outer edge of the grid item. If this is set to 'gutter' it will align to the grid columns gutters instead of extending to the edge.

<div data-grid="..., rules-row-align: gutter">...

rules-row-persist true

If set the rules between rows will persist when the grid is no longer in use (ie. mobile, smallest breakpoint before columns start to show. Useful to retain divider between rows on mobile.

<div data-grid="..., rules-row-persist: true">...

rules-row-stacked-only true

Same as persist adds rules to row before grid is being used (ie. mobile/small), except there will only be rules during this smallest breakpoint (mobile). Useful for when dividers don't make sense when the grid is displaying in columns but do make sense when columns are stacked on mobile.

<div data-grid="..., rules-row-stacked-only: true">...

rules-column (left|right)

Sets rules (dividers) between columns. Left adds rules between columns using the left side of the column. Right adds rules between columns using the left side of the column

<div data-grid="..., rules-column: left">...

rules-column-style [style key]

If alternate rule styles are configured, applies them by the key that was used to configure the alternate style when initializing the grid in SCSS.

<div data-grid="..., rules-row-style: light">...

rules-column-ends true

Specify that the rules should not be removed at the beginning or end of rows. Which happens by default depending on if the rules are on the left or right of the element.

<div data-grid="..., rules-column-ends: true">...

rules-column-align true

Sets rules (dividers) between columns

<div data-grid="..., rules-column: true">...

Options for 'data-grid-item'
Option Value Description/Example
width [# of columns]

Number of columns for grid, must match grids that are setup in site. For most projects this is just '12'. This is set up this way to allow mutliple grids.

<div data-grid-item="width: 4">...

width-[breakpoint] [# of columns]

Sets the width at a given breakpoint. Breakpoints are configured when initializing the grid in SCSS. Note this can be combined or used independently with the 'width' setting (above). For example if you only wanted the grid to start at the medium breakpoint you would just set 'width-medium'

<div data-grid-item="width-medium: 2">...

offset [# of columns]

Offsets the column by a certain number of columns

<div data-grid-item="..., offset: 2">...

offset-[breakpoint] [# of columns]

Same as width-[breakpoint] except for offset instead of width

<div data-grid-item="..., offset: 2">...

sticky [top, bottom]

Set's a column to be sticky

<div data-grid-item="..., sticky: top">...

Examples

  • Dotted Line is the container holding the data-grid
  • Solid Line is the individual cells including gutters
  • Purple Background is the cell's content
  • Solid Black Line is the grid's rules

Default Grid

Width of 6
Width of 3.
Width of 3

default (test sticky column)

Stuck to top
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis nisi, nec pretium justo varius sit amet. Vestibulum vitae quam in velit scelerisque tincidunt et vitae mauris. Fusce aliquet, ipsum sit amet lacinia euismod, est risus rhoncus ligula, eget egestas urna ligula nec enim. Fusce vulputate ornare ligula ut tempus. Sed accumsan orci sed turpis iaculis, at aliquam nibh rhoncus. Maecenas porta lorem a sem tincidunt, sed tristique ex laoreet. Nullam accumsan metus at lobortis interdum. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam sagittis sem erat, quis fermentum lectus ultrices quis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis nisi, nec pretium justo varius sit amet. Vestibulum vitae quam in velit scelerisque tincidunt et vitae mauris. Fusce aliquet, ipsum sit amet lacinia euismod, est risus rhoncus ligula, eget egestas urna ligula nec enim. Fusce vulputate ornare ligula ut tempus. Sed accumsan orci sed turpis iaculis, at aliquam nibh rhoncus. Maecenas porta lorem a sem tincidunt, sed tristique ex laoreet. Nullam accumsan metus at lobortis interdum. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam sagittis sem erat, quis fermentum lectus ultrices quis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis nisi, nec pretium justo varius sit amet. Vestibulum vitae quam in velit scelerisque tincidunt et vitae mauris. Fusce aliquet, ipsum sit amet lacinia euismod, est risus rhoncus ligula, eget egestas urna ligula nec enim. Fusce vulputate ornare ligula ut tempus. Sed accumsan orci sed turpis iaculis, at aliquam nibh rhoncus. Maecenas porta lorem a sem tincidunt, sed tristique ex laoreet. Nullam accumsan metus at lobortis interdum. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam sagittis sem erat, quis fermentum lectus ultrices quis.
Stuck to Bottom
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis nisi, nec pretium justo varius sit amet. Vestibulum vitae quam in velit scelerisque tincidunt et vitae mauris. Fusce aliquet, ipsum sit amet lacinia euismod, est risus rhoncus ligula, eget egestas urna ligula nec enim. Fusce vulputate ornare ligula ut tempus. Sed accumsan orci sed turpis iaculis, at aliquam nibh rhoncus. Maecenas porta lorem a sem tincidunt, sed tristique ex laoreet. Nullam accumsan metus at lobortis interdum. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam sagittis sem erat, quis fermentum lectus ultrices quis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis nisi, nec pretium justo varius sit amet. Vestibulum vitae quam in velit scelerisque tincidunt et vitae mauris. Fusce aliquet, ipsum sit amet lacinia euismod, est risus rhoncus ligula, eget egestas urna ligula nec enim. Fusce vulputate ornare ligula ut tempus. Sed accumsan orci sed turpis iaculis, at aliquam nibh rhoncus. Maecenas porta lorem a sem tincidunt, sed tristique ex laoreet. Nullam accumsan metus at lobortis interdum. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam sagittis sem erat, quis fermentum lectus ultrices quis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam commodo felis nisi, nec pretium justo varius sit amet. Vestibulum vitae quam in velit scelerisque tincidunt et vitae mauris. Fusce aliquet, ipsum sit amet lacinia euismod, est risus rhoncus ligula, eget egestas urna ligula nec enim. Fusce vulputate ornare ligula ut tempus. Sed accumsan orci sed turpis iaculis, at aliquam nibh rhoncus. Maecenas porta lorem a sem tincidunt, sed tristique ex laoreet. Nullam accumsan metus at lobortis interdum. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam sagittis sem erat, quis fermentum lectus ultrices quis.

Justify Content

Allows you to justify the columns (horizontal alignment). The default is start (left aligned)

default (justify start)

Width of 6
Width of 3.
Width of 3
Width of 3
Width of 3.
Width of 3

justify: center

Width of 6
Width of 3.
Width of 3
Width of 3
Width of 3.
Width of 3

justify: end

Width of 6
Width of 3.
Width of 3
Width of 3
Width of 3.
Width of 3

Align

Allows you to align the columns (vertical alignment within row). The default is stretch start. Note using stretch-end or stretch-center will stretch all columns to be the same height but will align the columns content to the end or center.

Default (stretch start)

Width of 6
Width of 3.
Width of 3

align: center

Width of 6
Width of 3.
Width of 3

gutters

You can remove the gutters between columns by adding this setting. The grid shows the default gutters size by default.

default

Element directly before grid
Width of 6
Width of 3.
Width of 3
Element directly after grid

gutters: false

Element directly before grid
Width of 6
Width of 3.
Width of 3
Element directly after grid

gutters-row

If set to 'top' gutters will be between items starting at the top including the first row (so it makes space above the first grid row. Bottom works the same way but on the bottom. True adds gutters between rows and to the top and bottom of the first/last grid row. Fit will only put gutters between the rows.

gutters-row: true

Element directly before grid
Width of 6
Width of 3.
Width of 3
Width of 3
Width of 3.
Width of 3
Element directly after grid

gutters-row: top

Element directly before grid
Width of 6
Width of 3.
Width of 3
Width of 3
Width of 3.
Width of 3
Element directly after grid

gutters-row: bottom

Element directly before grid
Width of 6
Width of 3.
Width of 3
Width of 3
Width of 3.
Width of 3
Element directly after grid

gutters-row: fit

Element directly before grid
Width of 6
Width of 3.
Width of 3
Width of 3
Width of 3.
Width of 3
Element directly after grid

gutter-scale

No alternated scales are configured for this site. Allows for different gutter scales to be used with grid. Requires setting up the scales when you configure/create the grid.

rules-row

Sets rules (dividers) between rows. Top adds rules to the rows top edge. Bottom adds rules to the rows bottom edge. Between adds rules between rows but not on top or bottom.

For demo purposes, the rules are set to 2px to aid in the visualization. Default is 1px

rules-row: top

Width of 6
Width of 3.
Width of 3
Width of 3
Width of 3.
Width of 3

rules-row: bottom

Width of 6
Width of 3.
Width of 3
Width of 3
Width of 3.
Width of 3

rules-row: between

Width of 6
Width of 3.
Width of 3
Width of 3
Width of 3.
Width of 3

rules-row-align

The default (without this set), will align to the outer edge of the grid item. If this is set to 'gutter' it will align to the grid columns gutters instead of extending to the edge.

rules-row-align: gutter

Width of 6
Width of 3.
Width of 3

rules-column

Sets rules (dividers) between columns. Left adds rules between columns using the left side of the column. Right adds rules between columns using the left side of the column

rules-column: right

Width of 6
Width of 3.
Width of 3
Width of 3
Width of 3.
Width of 3

rules-column: between align to gutter

Width of 6
Width of 3.
Width of 3
Width of 3
Width of 3.
Width of 3

item width

Number of columns for grid, must match grids that are setup in site. For most projects this is just '12'. This is set up this way to allow multiple grids. All examples specify the item's width

item offset

Offsets the column by a certain number of columns

Width of 6
Width of 3. Offset of 1
Width of 3. Offset of 2

default (justify start)

Width of 6
Width of 3.
Width of 3
Width of 3
Width of 3.
Width of 3