A layout component that creates two-dimensional grid-based layouts with precise control over placement and sizing.
import { Grid } from '@styled-system/jsx'<Grid
columns={3}
gap={4}
>
<Box p={4}>Item 1</Box>
<Box p={4}>Item 2</Box>
<Box p={4}>Item 3</Box>
<Box p={4}>Item 4</Box>
<Box p={4}>Item 5</Box>
<Box p={4}>Item 6</Box>
</Grid>Grid accepts all common properties mentioned in the layout guide along with these grid-specific properties:
| Property | CSS Property | Description |
|---|---|---|
columns | grid-template-columns | The number of columns in the grid |
gap | gap | The gap between the elements in the stack |
columnGap | column-gap | The gap between the elements in the stack horizontally |
rowGap | row-gap | The gap between the elements in the stack vertically |
minChildWidth | min-width | The minimum width of the child elements before wrapping (must not be used with columns) |
| Property | CSS Property | Description |
|---|---|---|
colSpan | grid-column | The number of columns the item spans |
rowSpan | grid-row | The number of rows the item spans |
colStart | grid-column-start | The column the item starts at |
colEnd | grid-column-end | The column the item ends at |
rowStart | grid-row-start | The row the item starts at |
rowEnd | grid-row-end | The row the item ends at |