Grid 栅格
24 栅格制,用 CSS Grid 实现(grid-template-columns: repeat(24, 1fr)),span / offset 直接映射到 grid-column,无需 flex 百分比换算。
基础用法
基础用法
span 12
span 12
span 8
span 8
span 8
offset 3
居中
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 批量声明
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
| 属性 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| justify | 主轴上排列 | 'start' | 'center' | 'end' | 'space-between' | 'space-around' | — | 'start' |
| align | 交叉轴上对齐 | 'top' | 'middle' | 'bottom' | — | 'top' |
| gutter | 列间距(px 或 [横向, 纵向]) | number | [number, number] | — | 0 |
| wrap | 是否换行 | boolean | — | true |
| sx | 快速布局属性 | SxProps | — | — |
Col Props
| 属性 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| span | 占据列数(24 栅格制) | number | — |