Grid
import { Grid } from '@sky-uk/ui-core';
Grid
is a utility component that surfaces Grid
properties. Grid is a two-dimensional layout method.
Nesting Grid components
As well as providing parent CSS grid styles Grid
also provides child grid properties such as $gridColumn
. This allows us to create nested grid layouts when required.
Auto Grids
To build a Grid
that allows for the creation of implicit rows or columns, you can use either $gridAutoRows
or $gridAutoColumns
. This is useful when you want to have rows or columns of equal height (for rows) or equal width (for columns) but the number of children may vary.
Auto positioning works for grid items that are not placed inside a row that has been sized by $gridTemplateRows
or $gridTemplateColumns
.
If you want to keep control over how the grid items are auto placed then this can be used in conjunction with $gridAutoFlow
. If using $gridAutoColumns
you will need to use $gridAutoFlow="column"
or your grid items will automatically be in rows.
Auto rows
Auto columns
System Modifiers
The Grid
component supports the props applied using the following system modifiers: