Skip to main content

Grid

Lays out children in a vertically + horizontally spaced layout. You normally use it with fixed size children as shown below:

Live Editor
Result
Loading...

Space

 /** 
* Minimum spacing between children
*/
$space?:
| CSSLength
| {
$v?: CSSLength,
$h?: CSSLength
}

Default vertical and horizontal space is 24px.

info

Example (vertical space=40px, horizontal space=10px):

Live Editor
Result
Loading...

Justify

 /** 
* Controls how the extra space around the children is handled
*/
$justify?:
/** Controls by child placement */
| 'start' /** default */
| 'center'
| 'end'
/** Controls by space */
| 'space-between'
| 'space-around'

We've seen the default start already (the extra space gets put on the right). Lets look at examples of the other options.

info

Example center (the extra space gets put around the children):

Live Editor
Result
Loading...
info

Example end (the extra space gets put at the left):

Live Editor
Result
Loading...
info

Example space-between (the extra space goes between items, items are pushed to the edges):

Live Editor
Result
Loading...
info

Example space-around (the extra space goes around items, each items gets a portion of the space left+right):

Live Editor
Result
Loading...

Scale

Grid supports the scale prop as explained in the scale principle.

DivProps

Grid supports all DivProps.

BaseProps

Grid supports all BaseProps.