Grid

Responsive two-dimensional layout with explicit and automatic tracks.

Add it to your project

Eject the complete grid group, then import from its generated local barrel. The copied source and CSS belong to your application.

bash
pnpm exec toucan eject grid
app.tsx
import { Grid, GridItem } from '@/components/toucan/grid';

Use when

Items need aligned rows and columns or responsive column spans.

Avoid when

Only one layout axis matters; Flex is simpler for that case.

Example

1
2
3
Auto 1
Auto 2
Auto 3
Auto 4
Responsive 1
Responsive 2
Responsive 3

API reference

Generated from packages/react/src/components. Only Toucan-specific props are listed; forwarded native props remain available as noted for each export.

GridGridItem

Grid

Props type: GridProps

NameTypeDefaultRequiredDescription
align"start" | "center" | "end" | "stretch" | "baseline" | { base?: FlexAlign; sm?: FlexAlign; md?: FlexAlign; lg?: FlexAlign; xl?: FlexAlign; }undefinedNoAlignment within the component layout.
columns1 | 2 | 3 | "auto" | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 7 | 9 | 11 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | { base?: GridColumns; sm?: GridColumns; md?: GridColumns; lg?: GridColumns; xl?: GridColumns; }1NoThe number of grid columns, including responsive values where supported.
gap0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | { base?: GridGap; sm?: GridGap; md?: GridGap; lg?: GridGap; xl?: GridGap; }undefinedNoSpace between child items from the Toucan scale.
minItemSizestringundefinedNoMinimum CSS size used by automatic grid tracks.

Also accepts the native div attributes that are not replaced by a Toucan prop.

GridItem

Props type: GridItemProps

NameTypeDefaultRequiredDescription
align"auto" | "start" | "center" | "end" | "stretch" | "baseline" | { base?: SelfAlign; sm?: SelfAlign; md?: SelfAlign; lg?: SelfAlign; xl?: SelfAlign; }undefinedNoAlignment within the component layout.
end1 | 2 | 3 | "auto" | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 7 | 9 | 11 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | { base?: GridLine; sm?: GridLine; md?: GridLine; lg?: GridLine; xl?: GridLine; }undefinedNoEnding grid line, including responsive values where supported.
justify"auto" | "start" | "center" | "end" | "stretch" | { base?: SelfJustify; sm?: SelfJustify; md?: SelfJustify; lg?: SelfJustify; xl?: SelfJustify; }undefinedNoMain-axis distribution within the component layout.
span1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 7 | 9 | 11 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | { base?: GridTrackCount; sm?: GridTrackCount; md?: GridTrackCount; lg?: GridTrackCount; xl?: GridTrackCount; }undefinedNoNumber of grid columns occupied by the item.
start1 | 2 | 3 | "auto" | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 7 | 9 | 11 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | { base?: GridLine; sm?: GridLine; md?: GridLine; lg?: GridLine; xl?: GridLine; }undefinedNoStarting grid line, including responsive values where supported.

Also accepts the native div attributes that are not replaced by a Toucan prop.

Type exports

GridColumns, GridItemProps, GridProps, GridSpan, GridTrackCount

ts
export type GridColumns = 1 | 2 | 3 | "auto" | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 7 | 9 | 11 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24;
ts
export type GridSpan = 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 7 | 9 | 11 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24;
ts
export type GridTrackCount = 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 7 | 9 | 11 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24;

Accessibility

  • Grid and GridItem preserve normal DOM order; keep source order meaningful.

Token families

gridbreakpointscale

Related components