# GridNode

<!-- schema:start — tự sinh từ grid.schema.ts, không sửa tay -->

Bố cục lưới nhiều cột. Chỉ chứa các cell, cần ít nhất một cell.

## Resolved name

`grid`

## Configurable props

### Props

| Prop | Giá trị | Responsive | Mô tả |
| --- | --- | --- | --- |
| `hidden` | `true · false` | có | Ẩn node ở breakpoint này |
| `cols` | `số nguyên 1..24` | có | Số cột của lưới |

### `sx`

| Key | Giá trị | Breakpoint |
| --- | --- | --- |
| `rowGap` | `px` | mọi breakpoint |
| `columnGap` | `px` | mọi breakpoint |
| `alignItems` | `'start' · 'center' · 'end' · 'stretch'` | mọi breakpoint |
| `justifyItems` | `'start' · 'center' · 'end'` | mọi breakpoint |
| `width` | `px · 'N%' · 'auto' · 'fit-content'` | mọi breakpoint |
| `height` | `px · 'N%' · 'auto'` | mọi breakpoint |
| `marginTop` | `px · 'auto'` | mọi breakpoint |
| `marginRight` | `px · 'auto'` | mọi breakpoint |
| `marginBottom` | `px · 'auto'` | mọi breakpoint |
| `marginLeft` | `px · 'auto'` | mọi breakpoint |
| `paddingTop` | `px` | mọi breakpoint |
| `paddingRight` | `px` | mọi breakpoint |
| `paddingBottom` | `px` | mọi breakpoint |
| `paddingLeft` | `px` | mọi breakpoint |
| `borderStyle` | `'solid' · 'dashed' · 'dotted'` | mọi breakpoint |
| `borderTopWidth` | `px` | mọi breakpoint |
| `borderRightWidth` | `px` | mọi breakpoint |
| `borderBottomWidth` | `px` | mọi breakpoint |
| `borderLeftWidth` | `px` | mọi breakpoint |
| `borderColor` | `color` | mọi breakpoint |
| `borderTopLeftRadius` | `px 0..9999` | mọi breakpoint |
| `borderTopRightRadius` | `px 0..9999` | mọi breakpoint |
| `borderBottomRightRadius` | `px 0..9999` | mọi breakpoint |
| `borderBottomLeftRadius` | `px 0..9999` | mọi breakpoint |
| `backgroundColor` | `color` | mọi breakpoint |
| `backgroundImage` | `url(https://…)` | mọi breakpoint |
| `backgroundSize` | `'cover' · 'contain' · 'auto'` | mọi breakpoint |
| `backgroundPosition` | `'left top' · 'top' · 'right top' · 'left' · 'center' · 'right' · 'left bottom' · 'bottom' · 'right bottom'` | mọi breakpoint |
| `backgroundRepeat` | `'no-repeat' · 'repeat-x' · 'repeat-y' · 'repeat'` | mọi breakpoint |
| `backgroundAttachment` | `'scroll' · 'fixed' · 'local'` | mọi breakpoint |

`color` = `var(--color-{primary\|secondary\|red\|orange\|yellow\|green\|blue\|violet\|neutral}-{100..800\|contrast}) · var(--color-background-{subtle\|default\|emphasis}) · var(--color-border-default) · var(--color-surface-default) · var(--color-common-{black\|white}) · #rgb · #rrggbb`

## Rules

- **Nội dung**: chỉ nhận `cell`, ít nhất 1 node con.
- **Cha hợp lệ**: bất kỳ.

<!-- schema:end -->

## Usage

```tsx
import { GridNode, CellNode } from '@janbox/storefront-builder';

// 2 cột cố định
<GridNode cols={2}>
  <CellNode>...</CellNode>
  <CellNode>...</CellNode>
</GridNode>

// Responsive: 1 cột mobile, 3 cột desktop
<GridNode cols={1} md={{ cols: 3 }}>
  <CellNode>...</CellNode>
  <CellNode>...</CellNode>
  <CellNode>...</CellNode>
</GridNode>

// sx responsive: gap nhỏ trên mobile, lớn hơn trên desktop
<GridNode
  cols={1}
  md={{ cols: 2 }}
  sx={{
    columnGap: 8,
    rowGap: 8,
    paddingTop: 16,
    paddingBottom: 16,
    md: {
      columnGap: 24,
      rowGap: 24,
      paddingTop: 32,
      paddingBottom: 32,
    },
  }}
>
  <CellNode>...</CellNode>
  <CellNode>...</CellNode>
</GridNode>

// Grid với background
<GridNode
  cols={2}
  sx={{
    backgroundColor: '#f5f5f5',
    paddingTop: 32,
    paddingBottom: 32,
  }}
>
  <CellNode>...</CellNode>
  <CellNode>...</CellNode>
</GridNode>
```

## Related nodes

- [`CellNode`](../cell/README.md) — the only valid direct child of `GridNode`
