Skip to main content

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​

PropDescriptionTypeOptionsDefault
justifyMain-axis arrangement'start' | 'center' | 'end' | 'space-between' | 'space-around'—'start'
alignCross-axis alignment'top' | 'middle' | 'bottom'—'top'
gutterColumn spacing (px or [horizontal, vertical])number | [number, number]—0
wrapWhether to wrapboolean—true
sxLayout shorthandSxProps——

Col Props​

PropDescriptionTypeOptionsDefault
spanNumber of columns occupied (24-column grid)number——
offsetNumber of columns to offset from the leftnumber——
pushNumber of columns to shift rightnumber——
pullNumber of columns to shift leftnumber——
xsEffective below 640px (falls back to smaller tiers when unset)LhColSize——
smEffective at ≥640pxLhColSize——
mdEffective at ≥768pxLhColSize——
lgEffective at ≥1024pxLhColSize——
xlEffective at ≥1280pxLhColSize——
sizesResponsive sizes declared per breakpoint (equivalent to xs~xl, choose either)Partial<Record<LhGridBreakpoint, LhColSize>>——
sxLayout shorthandSxProps——
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'