Grid
A responsive grid of equal columns with one gap.
SourceStyles source@monoline/react 0.5.0Markdown for AI toolsstable
- Built on native elements
- A plain div; source order is reading order.
- Styles in one file:
grid.css
Import
import '@monoline/css';
import {Grid} from '@monoline/react';
Not installed yet? Pick a route.
Copies the source and its styles into your project.
npx monoline add grid
Usage
import {Card, Grid} from '@monoline/react';
<Grid columns={3}>
{['One', 'Two', 'Three'].map((n) => <Card key={n}>{n}</Card>)}
</Grid>
Examples
Three columns
Auto-fit
Props
GridProps
| Prop | Type | Default | Description |
|---|---|---|---|
columns | 1 | 2 | 3 | 4 | 5 | 6 | – | Fixed number of equal columns. Omit for an auto-fit grid. |
minColumn | string | '16rem' | With auto-fit: the smallest a column may be, as a CSS length such as `16rem`. |
gap | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 4 | Step on the spacing scale, 1 to 9. |
Data Attributes
State is exposed through attributes. Style it with these selectors, not with class toggles.
This component sets no state attributes.
CSS classes
| Class | Stylesheet |
|---|---|
.grid | grid.css |
.grid-fixed | grid.css |
Customization
Style it with the kit's tokens in your own CSS, loaded after @monoline/css. Prefer the attributes above over extra classes. See Theming for every token.
app.css
.grid {
border-color: var(--accent);
}
Accessibility
- A plain div; source order is reading order.