Skip to Content
Sponsor

Grid

A primitive useful for grid layouts. Grid is Box with display: grid and comes with helpful style shorthand. It renders a div element.

Import#

  • Grid: The main wrapper with display: grid
  • GridItem: Used as a child of Grid to control the span, and start positions within the grid.

Template columns#

Here's an example of using grid template columns with the grid component, and applying a gap or space between the grid items.

Editable Example

Spanning columns#

In some layouts, you might need certain grid items to span specific amount of columns instead of an even distribution. Pass the span prop to GridItem component to manage this distribution.

Editable Example

Starting and ending lines#

Pass the start and end prop to GridItem component to make an element start or end at the nth grid position.

In some layouts, you might need certain grid items to span specific amount of columns instead of an even distribution. Pass the span prop to GridItem component to manage this distribution.

Editable Example

Props#

Grid Props#

Grid composes Box so you can pass all the Box prop, and these shorthand prop to save you some time:

Verbose PropShorthand Prop
gridAreaarea
gridTemplateAreastemplateAreas
gridGapgap
gridRowGaprowGap
gridColumnGapcolumnGap
gridAutoColumnsautoColumns
gridColumncolumn
gridRowrow
gridAutoFlowautoFlow
gridAutoRowsautoRows
gridTemplateRowstemplateRows
gridTemplateColumnstemplateColumns

GridItem Props#

Verbose PropShorthand Prop
gridColumnSpancolSpan
gridRowSpanrowSpan
gridColumnStartcolStart
gridColumnEndcolEnd
gridRowStartrowStart
gridRowEndrowEnd
Edit this page