Grid
CSS Grid container — columns, rows, gap, templateColumns, templateRows, and the rest of the grid API as token-aware props. The right reach when you need explicit row × column placement.
Plain <div>. Grid layout has no implicit semantics — pair with semantic children (<article>, headings) when grid items represent content; otherwise leave a Grid as a layout-only wrapper.
import { Box, Grid } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<Grid
columns={{ base: 1, sm: 2, md: 3 }}
gap="3"
padding="4"
background="bg.subtle"
borderRadius="md"
>
<Box padding="3" background="bg.surface" borderRadius="sm">
A
</Box>
<Box padding="3" background="bg.surface" borderRadius="sm">
B
</Box>
<Box padding="3" background="bg.surface" borderRadius="sm">
C
</Box>
</Grid>
);
}
Columns (responsive)
Section titled “Columns (responsive)”The shortcut columns={n} produces an evenly-divided n-column track. Pass a responsive map to shift column count per breakpoint — the most common dashboard / card-grid pattern.
import { Box, Grid } from '@arshad-shah/cynosure-react';
const CELLS = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'];
export default function Example() {
return (
<Grid
columns={{ base: 1, sm: 2, md: 3, lg: 4 }}
gap="3"
padding="4"
background="bg.subtle"
borderRadius="md"
>
{CELLS.map((cell) => (
<Box key={cell} padding="3" background="bg.surface" borderRadius="sm">
Cell {cell}
</Box>
))}
</Grid>
);
}
Explicit tracks
Section titled “Explicit tracks”templateColumns accepts a raw grid-template-columns string (or a responsive map) when you need non-uniform tracks — e.g. "240px 1fr" for a sidebar + main shell. Combine with gridColumn / gridRow on children to span tracks.
import { Box, Grid } from '@arshad-shah/cynosure-react';
export default function Example() {
return (
<Grid templateColumns="160px 1fr" gap="3" padding="4" background="bg.subtle" borderRadius="md">
<Box padding="3" background="bg.surface" borderRadius="sm">
Sidebar (160px)
</Box>
<Box padding="3" background="bg.surface" borderRadius="sm">
Main column (1fr)
</Box>
<Box padding="3" background="bg.surface" borderRadius="sm" gridColumn="1 / -1">
Footer (spans both columns)
</Box>
</Grid>
);
}
Recipes
Section titled “Recipes”- Card grids:
<Grid columns={{ base: 1, sm: 2, lg: 3, xl: 4 }} gap="4" />is the canonical responsive card layout. - For uniform columns without writing the responsive map, reach for
SimpleGrid— it’sGridtuned for the 90% case. - App shells with sidebar + main:
templateColumns="240px 1fr"keeps the sidebar pinned and the main column responsive in one prop. Boxand every layout primitive exposegridArea,gridColumn,gridRowso a Grid child can claim a span without a wrapper.