Grid
Lays children out on a CSS grid, with a fixed column count or auto-fill / auto-fit.
Import
Copy code
import { Grid } from '@k8ordo/ui';Usage
A
B
C
D
E
F
Copy code
<Grid cols={3} gap="md">
{items.map((label) => <Card>{label}</Card>)}
</Grid>Fixed columns
A
B
C
D
E
F
G
H
A
B
C
D
E
F
G
H
Copy code
<Grid cols={2} gap="sm">…</Grid>
<Grid cols={4} gap="sm">…</Grid>Auto-fill
With cols="auto-fill" or "auto-fit", minItemSize sets the minimum width of a cell. The number of columns then follows the width.
A
B
C
D
E
F
G
H
Copy code
<Grid cols="auto-fill" minItemSize={32} gap="md">…</Grid>Props
children?- Type:
ReactNode - Default: -
cols?- Type:
1|2|3|4|5|6|'auto-fill'|'auto-fit' - Default:
'auto-fill' gap?- Type:
GapSize - Default:
'md' minItemSize?- Type:
24|32|40|48|64|80 - Default:
48
| Prop | Type | Default |
|---|---|---|
children? | ReactNode | - |
cols? | 1|2|3|4|5|6|'auto-fill'|'auto-fit' | 'auto-fill' |
gap? | GapSize | 'md' |
minItemSize? | 24|32|40|48|64|80 | 48 |
Inherited attributes (except the ones set internally): HTMLAttributes<HTMLDivElement>