- Docs
- Components
- Layout
Grid
Equal columns that change with the window's size class, with gaps from the space scale.
- Import
- @qeetrix/react
- Status
- StableSince 0.0.2
- Renders
<div>Server-rendered- Tested
- WCAG 2.2 AAaxe on every pull request
01
Import
// From the package: a build keeps only what it uses.
import { Grid, GridItem } from "@qeetrix/react";
// Or from its own path.
import { Grid, GridItem } from "@qeetrix/react/grid";02
Props
And every native attribute of the element it renders.
| Prop | Type | Default | What it does |
|---|---|---|---|
columns | 1 – 12 | { base, medium, expanded, large, xlarge } | 1 | Equal columns: one count, or one per window size class. |
gap | "none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "md" | Space between cells. |
align | "start" | "center" | "end" | "stretch" | "stretch" | Cells in a row, up and down. |
render | ReactElement | a <div> | A <ul> around <li> GridItems. |
GridItem: span · start | 1 – 12 | per size class | 1 · the next free cell | Columns spanned, and the one it starts in; each size class inherits the nearest smaller one set. |
03
Parts
Each part carries a data-slot, for tests and placement.
| data-slot | Element | What it is |
|---|---|---|
grid | <div> | data-gap, data-align. |
grid-item | <div> | A spanning cell. |
04
A detail page
The record's main column and its side column, side by side from 1200px.
<Grid columns={{ base: 1, large: 3 }} gap="xl">
<GridItem span={{ large: 2 }}>
<Card title="Profile" level={2}>…</Card>
</GridItem>
<Card title="Recent activity" level={2}>…</Card>
</Grid>