Grid

A simple grid layout component that provides a convenient way to create grid layouts with various alignment and spacing options. Note that this component is not meant for complex grid layouts.

Most layout controls are boolean toggles. When you omit them, Grid falls back to CSS defaults such as grid, row auto-flow, stretch, and the theme s gap.

Item 1
Item 2
Item 3
Wide
Narrow
Narrow
Top Left
Top Right
Bottom Left
Bottom Right
Wide
2
Tall
4
5

Props

The idea is that you control the component by using boolean props. This allows you to define layouts quickly.

NameDefaultType
inlinefalseboolean
Makes the grid container inline
gapsxxs xs s m l xl xxl xxxl number
Gap between grid items (theme spacing token or custom unit value)
rowsnumber string
Number of rows or custom grid template rows
columnsnumber string
Number of columns or custom grid template columns
centerfalseboolean
Centers items on both axes
x-startstretchboolean
Aligns items to the start on the inline axis
x-endfalseboolean
Aligns items to the end on the inline axis
x-centerfalseboolean
Centers items on the inline axis
x-stretchstretchboolean
Stretches items across the inline axis
y-startstartboolean
Aligns items to the start on the block axis
y-endfalseboolean
Aligns items to the end on the block axis
y-centerfalseboolean
Centers items on the block axis
y-baselinefalseboolean
Aligns items along their baselines
y-stretchstretchboolean
Stretches items across the block axis
auto-flow-rowrowboolean
Auto-places grid items by rows
auto-flow-columnfalseboolean
Auto-places grid items by columns
auto-flow-densefalseboolean
Enables dense auto-placement packing
expandfalseboolean
Makes the grid container expand to full width

Slots

NameAcceptsDescription
defaultanyThe grid items to be laid out