The Grid component provides a flexible foundation for creating responsive layouts. Here are practical code examples showing different usage patterns.

Basic Grid

Create a basic grid layout with container and size props. The size prop accepts values from 1-12 representing column spans.

size=5
size=5
size=6
size=6

Responsive Grid

Use breakpoint objects to define different layouts for different screen sizes. Each breakpoint applies to that size and larger unless overridden.

xs=6 md=8
xs=6 md=4
xs=6 md=4
xs=6 md=8

Grid Spacing

Control the space between grid items using the spacing prop. The value corresponds to theme spacing units.

Item 1
Item 2
Item 3
Item 4

Row and Column Spacing

Use rowSpacing and columnSpacing for independent control over row and column gaps.

1
2
3
4

Auto Layout

Use flexible sizing options for dynamic layouts that adapt to content.

Growing Columns

Use size="grow" to make columns take up available space equally.

size=grow
size=6

Variable Width Content

Use size="auto" to size columns based on their content width.

size=auto
size=6

Grid Offset

Use the offset prop to push grid items to the right, creating gaps or asymmetrical layouts.

1
2
3
4

Centered Content

Center content within grid items using flexbox properties directly on the Grid component.

A
B
C

Column Direction

Use the direction="column" prop to stack grid items vertically instead of horizontally.

Item 1
Item 2
Item 3
Item 4