# Grid

The grid plugin creates component classes to easily work with a 12 columns layout.

# Configuration

The plugin can be configured with the theme.gridPlugin property:

module.exports = {
  theme: {
    gridPlugin: {
      columns: 12,
      gutterWidth: 1,
      gutterUnit: 'rem',
      prefix: 'c-',
    },
  },
};


 
 
 
 
 
 


1
2
3
4
5
6
7
8
9
10

# columns

  • Type: Number
  • Default: 12

The total number of columns.

# gutterWidth

  • Type: [ Number, String, Object ]
  • Default: 1

The width of the grid's gutters provided as a unitless number. You can configure different widths per breakpoint by providing an object with the following schema:

{
  default: <value>,
  ...<screen>: <value,
}
1
2
3
4

The following configuration...

module.exports = {
  theme: {
    screens: {
      s: '600px',
      m: '1200px',
      l: '1800px',
    },
    gridPlugin: {
      gutterWidth: {
        default: 2,
        m: 4,
      },
    },
  },
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

...would generate a grid component with gutters of size 2 for viewports from 0 to 1200px and of size 4 for viewports from 1200px and up.

# gutterUnit

  • Type: String
  • Default: 'rem'

The CSS unit used for the gutters.

# prefix

  • Type: String
  • Default : ''

The prefix used by the plugin to prevent conflicts with other classes. It defaults to an empty string.

# Classes

# Container

ClassDescriptionVariants
.grid@todo[]
.grid-nested@todo[]
.grid-no-gutter@todo[]

# Row

ClassDescriptionVariants
.grid-row@todoresponsive
.grid-row-start@todoresponsive
.grid-row-center@todoresponsive
.grid-row-end@todoresponsive
.grid-row-stretch@todoresponsive

# Columns

ClassDescriptionVariants
.grid-pull-<count>@todoresponsive
.grid-push-<count>@todoresponsive
.grid-col-<count>@todoresponsive
.grid-col-center@todoresponsive
.grid-col-clear@todoresponsive
.grid-col-left@todoresponsive
.grid-col-no-clear@todoresponsive
.grid-col-right@todoresponsive

# Examples

# Simple

1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
3
3
3
3
4
4
4
6
6
12
<div class="grid">
  <div class="grid-row mb-2">
    <div class="grid-col-1">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="grid-col-1">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="grid-col-1">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="grid-col-1">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="grid-col-1">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="grid-col-1">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="grid-col-1">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="grid-col-1">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="grid-col-1">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="grid-col-1">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="grid-col-1">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="grid-col-1">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
  </div>
  <div class="grid-row mb-2">
    <div class="grid-col-2">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">2</div>
    </div>
    <div class="grid-col-2">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">2</div>
    </div>
    <div class="grid-col-2">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">2</div>
    </div>
    <div class="grid-col-2">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">2</div>
    </div>
    <div class="grid-col-2">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">2</div>
    </div>
    <div class="grid-col-2">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">2</div>
    </div>
  </div>
  <div class="grid-row mb-2">
    <div class="grid-col-3">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">3</div>
    </div>
    <div class="grid-col-3">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">3</div>
    </div>
    <div class="grid-col-3">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">3</div>
    </div>
    <div class="grid-col-3">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">3</div>
    </div>
  </div>
  <div class="grid-row mb-2">
    <div class="grid-col-4">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">4</div>
    </div>
    <div class="grid-col-4">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">4</div>
    </div>
    <div class="grid-col-4">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">4</div>
    </div>
  </div>
  <div class="grid-row mb-2">
    <div class="grid-col-6">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">6</div>
    </div>
    <div class="grid-col-6">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">6</div>
    </div>
  </div>
  <div class="grid-row mb-2">
    <div class="grid-col-12">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">12</div>
    </div>
  </div>
</div>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98

# No gutter

1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
3
3
3
3
4
4
4
6
6
12
<div class="grid grid-no-gutter">
  ...
</div>
1
2
3

# Nested

1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
3
3
3
3
4
4
4
6
6
12
<div class="grid grid-nested">
  ...
</div>
1
2
3

# Tailwind only equivalent

The grid plugin can be replaced with Tailwind utility classes for expert users:

Tailwind

1
1
1
1
1
1
1
1
1
1
1
1

Grid plugin

1
1
1
1
1
1
1
1
1
1
1
1
<div class="px-2 s:px-4 l:px-6 xxl:px-8">
  <div class="clearfix -mx-2 s:-mx-4 l:-mx-6 xxl:-mx-8">
    <div class="w-1/12 float-left px-2 s:px-4 l:px-6 xxl:px-8">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="w-1/12 float-left px-2 s:px-4 l:px-6 xxl:px-8">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="w-1/12 float-left px-2 s:px-4 l:px-6 xxl:px-8">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="w-1/12 float-left px-2 s:px-4 l:px-6 xxl:px-8">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="w-1/12 float-left px-2 s:px-4 l:px-6 xxl:px-8">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="w-1/12 float-left px-2 s:px-4 l:px-6 xxl:px-8">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="w-1/12 float-left px-2 s:px-4 l:px-6 xxl:px-8">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="w-1/12 float-left px-2 s:px-4 l:px-6 xxl:px-8">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="w-1/12 float-left px-2 s:px-4 l:px-6 xxl:px-8">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="w-1/12 float-left px-2 s:px-4 l:px-6 xxl:px-8">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="w-1/12 float-left px-2 s:px-4 l:px-6 xxl:px-8">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
    <div class="w-1/12 float-left px-2 s:px-4 l:px-6 xxl:px-8">
      <div class="h-4 text-grey-600 bg-white flex items-center justify-center">1</div>
    </div>
  </div>
</div>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Last Updated: 6/14/2021, 5:09:02 PM