Layout
Grid
A CSS grid with 1–12 equal columns, responsive column counts and item alignment.
Purpose
Grid lays items out in equal columns that line up across rows: card grids, dashboards, galleries.
Import
import { Grid } from "@neshel-ui/layout";Usage
Preview: grid-columns
Revenue
Customers
Orders
Refunds
Visits
Conversion
import { Grid } from "@neshel-ui/layout";
import { Tile } from "./_tile";
const cards = ["Revenue", "Customers", "Orders", "Refunds", "Visits", "Conversion"];
/** One column on phones, two from sm, three from lg (responsive columns recipe). */
export default function GridColumns() {
return (
<Grid columns={{ base: 1, sm: 2, lg: 3 }} space={{ base: "2", md: "4" }}>
{cards.map((card) => (
<Tile key={card}>{card}</Tile>
))}
</Grid>
);
}API
GridProps
| Prop | Type | Default | Description |
|---|---|---|---|
| align | Responsive<GridAlign> | — | — |
| alignX | Responsive<GridAlign> | — | — |
| alignY | Responsive<GridAlign> | — | — |
| as | LayoutElement | — | — |
| asChild | boolean | — | — |
| columns | Responsive<GridColumns> | — | — |
| ref | Ref<HTMLElement> | — | — |
| space | Responsive<SpaceValue> | — | — |
| spaceX | Responsive<SpaceValue> | — | — |
| spaceY | Responsive<SpaceValue> | — | — |
Also accepts the props of: React DOM attributes.
GridColumns
type GridColumns = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12GridAlign
Grid item alignment (justify-items / align-items).
type GridAlign = MainAxisAlign | "stretch"columns: 1–12 (responsive), each columnminmax(0, 1fr).alignX→justify-items,alignY→align-items(start center end stretch).spaceX/spaceYset column and row gaps separately.
Spanning and areas
Item spans, rows and template areas are not props. Use utilities (className="lg:col-span-2") or your
own CSS on the children — see the dashboard recipe.
Common mistakes
- Using
Gridfor a single row of items of different widths:Inlinefits better. - Expecting auto-fit columns: the column count is explicit by design; make it responsive instead.