Grid
A 24-column grid built on CSS Grid (grid-template-columns: repeat(24, 1fr)); span / offset map directly to grid-column, with no flex percentage math.
Basic usage
Basic usage
span 12
span 12
span 8
span 8
span 8
offset 3
Centered
span 8
span 8
span 8
span 8
span 24 / md 12 / xl 8
span 24 / md 12 / xl 8
span 24 / xl 8
span 8 push 8
pull 2
sizes in one object
import { LhRow, LhCol } from '@lh-ui/react'
export default function Demo() {
return (
<LhRow gutter={12}>
<LhCol span={12}>span 12</LhCol>
<LhCol span={12}>span 12</LhCol>
<LhCol span={8}>span 8</LhCol>
<LhCol span={8}>span 8</LhCol>
<LhCol span={8}>span 8</LhCol>
</LhRow>
)
}
Row Props
| Prop | Description | Type | Options | Default |
|---|---|---|---|---|
| justify | Main-axis arrangement | 'start' | 'center' | 'end' | 'space-between' | 'space-around' | — | 'start' |
| align | Cross-axis alignment | 'top' | 'middle' | 'bottom' | — | 'top' |
| gutter | Column spacing (px or [horizontal, vertical]) | number | [number, number] | — | 0 |
| wrap | Whether to wrap | boolean | — | true |
| sx | Layout shorthand | SxProps | — | — |
Col Props
| Prop | Description | Type | Options | Default |
|---|---|---|---|---|
| span | Number of columns occupied (24-column grid) | number | — | — |
| offset | Number of columns to offset from the left | number | — | — |
| push | Number of columns to shift right | number | — | — |
| pull | Number of columns to shift left | number | — | — |
| xs | Effective below 640px (falls back to smaller tiers when unset) | LhColSize | — | — |
| sm | Effective at ≥640px | LhColSize | — | — |
| md | Effective at ≥768px | LhColSize | — | — |
| lg | Effective at ≥1024px | LhColSize | — | — |
| xl | Effective at ≥1280px | LhColSize | — | — |
| sizes | Responsive sizes declared per breakpoint (equivalent to xs~xl, choose either) | Partial<Record<LhGridBreakpoint, LhColSize>> | — | — |
| sx | Layout shorthand | SxProps | — | — |
Responsive breakpoints
xs / sm / md / lg / xl follow Tailwind thresholds (640 / 768 / 1024 / 1280); unset tiers fall back to smaller ones (xs is always the last fallback), and when no breakpoint is declared at all, span applies. offset / push / pull also work per breakpoint (declare sizes as objects). Resize the browser window to watch the layout change.
Accessibility
- Pure layout components with no interactive semantics; do not use the grid to carry lists that need semantic structure (use List / Table instead)
Styles
import '@lh-ui/react/style/grid'