Grid

CSS Grid as a Box — tokenized columns, rows, gaps and alignment, with Grid.Item for placement.

1

2

3

4

5

6

Import#

import { Grid } from "astralis-ui";
// Grid.Item is available on the component itself

Spanning#

Grid.Item places children explicitly: colSpan/rowSpan for size, colStart/rowStart for position — the dashboard staples.

2 × 2

2 × 1

1

1

Responsive columns#

columns (like every layout prop) accepts a breakpoint map — the standard card-grid recipe.

Mercury

Venus

Earth

Mars

Jupiter

Saturn

Named template areas#

For genuinely custom layouts, templateAreas, templateColumns and templateRows accept raw CSS strings (applied as inline styles), and Grid.Item area snaps children to the named cells.

header

sidebar

main

footer

Props#

Grid extends Box, so every style prop works here too.

PropTypeDefaultDescription
columns"1" – "12" | "none"Number of equal columns.
rows"1" – "6" | "none"Number of equal rows.
gap · rowGap · columnGap"0.5" – "96" (spacing scale)Track gaps, together or per axis.
flow"row" | "col" | "dense" | "col-dense""row"Auto-placement direction.
autoColumns · autoRows"auto" | "min" | "max" | "fr"Sizing for implicitly created tracks.
justifyItems · alignItems · placeItems"start" | "center" | "end" | "stretch" (+ "baseline" for alignItems)Item alignment within their cells.
justifyContent · alignContent · placeContent"start" | "center" | "end" | "between" | "around" | "evenly" | "stretch"Track alignment within the container.
templateColumns · templateRows · templateAreasstringEscape hatches — arbitrary track/area templates, applied as inline styles.

Grid.Item#

PropTypeDefaultDescription
colSpan · rowSpan"1" – "12" | "full"How many tracks the item spans.
colStart/colEnd · rowStart/rowEnd"1" – "13" | "auto"Explicit grid-line placement.
areastringNamed area matching the container's templateAreas.
order"1" – "12" | "first" | "last" | "none"Visual order, independent of source order.
alignSelf · justifySelf · placeSelf"auto" | "start" | "end" | "center" | "stretch"Per-item alignment override.