ComponentsGrid

Grid

The grid creates visual consistency between layouts while allowing flexibility across a wide variety of designs. This component is based on a 12-column grid layout.

It's based on the Material UI Grid.

However, the number of columns is set to 12 for all breakpoints, as it serves most of the use cases and simplifies the implementation. To opt-in to the Design System directives, you can set the columns prop to auto.

Also, the Design System specifications are omissive about the horizontal gutters. The HvGrid sets them to the same value as the vertical gutters, depending on the breakpoint. It can be overridden by setting the rowSpacing prop.

GitHub LogoSource Code

Please refer to the Layout documentation for more information on building layouts with UI Kit.

If you want to create a simple grid where items are distributed accross a specific number of columns, checkout the HvSimpleGrid component.

Default grid

The example below illustrates a common grid layout where items occupy different number of columns based on the screen size.

Current width: xs
xs=12 lg=6
xs=12 lg=6
xs=12 md=6 lg=4
xs=12 md=6 lg=4
xs=12 md=6 lg=4
xs=12 sm=6 lg=3 xl=2
xs=12 sm=6 md=4 lg=3 xl=2
xs=12 sm=6 md=4 lg=3 xl=2
xs=12 sm=6 md=4 lg=3 xl=2
xs=12 sm=6 md=4 lg=3 xl=2
xs=12 sm=6 md=4 lg=3 xl=2

The 12 columns

Grid using the default 12 columns. You can resize the browser to see the gutters’ size change.

Current width: xs (gutter size: 15px)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

Different number of columns

If you set the columns prop to auto, the grid will automatically adjust the number of columns based on the current breakpoint. Resize the browser to see the number of columns change.

Current width: xs (4 columns)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24