Layout
Grid
CSS grid with responsive column templates and token gaps. SimpleGrid creates equal columns — a fixed count, or as many as fit.
import { Grid, GridItem, SimpleGrid } from '@reactloom/ui';Examples
Responsive columns
Main — 3 of 4 columns from md
Aside
Full-width row
import { Box, Grid, GridItem } from '@reactloom/ui';
const Cell = ({ children }: { children: string }) => (
<Box padding="4" background="subtle" radius="md" bordered style={{ height: '100%' }}>{children}</Box>
);
export default function Example() {
return (
<Grid columns={{ base: 1, md: 4 }} gap="4" style={{ width: '100%' }}>
<GridItem colSpan={{ base: 'full', md: 3 }}><Cell>Main — 3 of 4 columns from md</Cell></GridItem>
<Cell>Aside</Cell>
<GridItem colSpan="full"><Cell>Full-width row</Cell></GridItem>
</Grid>
);
}Auto-fitting columns
minChildWidth needs no breakpoints.
Revenue
—
Customers
—
Churn
—
Tickets
—
NPS
—
MRR
—
import { Card, SimpleGrid } from '@reactloom/ui';
export default function Example() {
// As many 12rem columns as fit — no breakpoints needed.
return (
<SimpleGrid minChildWidth="12rem" gap="4" style={{ width: '100%' }}>
{['Revenue', 'Customers', 'Churn', 'Tickets', 'NPS', 'MRR'].map((name) => (
<Card key={name} padding="sm">
<Card.Description>{name}</Card.Description>
<Card.Title>—</Card.Title>
</Card>
))}
</SimpleGrid>
);
}API reference
Grid props
| Prop | Type | Default |
|---|---|---|
columnsA count or any grid-template-columns value. | Responsive<number | string> | — |
gap | Responsive<Space> | '4' |
alignItems | 'start' | 'center' | 'end' | 'stretch' | — |
GridItem props
| Prop | Type | Default |
|---|---|---|
colSpan | Responsive<number | 'full'> | — |
SimpleGrid props
| Prop | Type | Default |
|---|---|---|
minChildWidthe.g. "12rem". | string | — |
columns | Responsive<number> | — |
gap | Responsive<Space> | '4' |
Customization
Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.
State attributes
Target these in your CSS to style states without depending on class names.
| Attribute | Values |
|---|---|
[data-align] | present when on |
Accessibility
- Keep DOM order equal to visual order.
Usage guidelines
Do
- Use SimpleGrid for card collections.
Don’t
- Don’t reorder content visually with grid placement.