# GridProvider

Provides CSS custom properties for responsive grid column calculations. Children can use `$column-width` for precise column sizing.

## When to Use

- Responsive grid layouts with consistent column sizing
- Layouts that need to calculate column widths based on container size
- Grid systems with configurable column counts

## Properties

- **`columns`** `number` (default: `2`) — Number of grid columns
- **`gap`** `string | number` (default: `0`) — Gap between columns, as a single Tasty value such as `'1x'`, or a number of pixels. A string needs a unit: `'0'` makes `--column-width` invalid
- **`width`** `string | number` — Forced container width (bypasses auto-detection), as a single Tasty value or a number of pixels
- **`initialWidth`** `string | number` — Initial width before resize observer kicks in, as a single Tasty value or a number of pixels

### CSS Custom Properties Provided

- `--grid-width` — Total grid width
- `--columns-amount` — Number of columns
- `--column-gap` — Gap between columns
- `--column-width` — Calculated width per column

### Base Properties

Pass `tokens` to set custom properties on the grid provider. Its grid width, column count and gap tokens remain available to children.

### Style Defaults

- `display` — `contents`

### Style Properties

These properties allow direct style application without using the `styles` prop:

- **Base:** `display`, `font`, `preset`, `hide`, `whiteSpace`, `opacity`, `transition`
- **Position:** `gridArea`, `order`, `gridColumn`, `gridRow`, `placeSelf`, `alignSelf`, `justifySelf`, `zIndex`, `margin`, `blockMargin`, `inlineMargin`, `inset`, `blockInset`, `inlineInset`, `position`, `scrollMargin`, `blockScrollMargin`, `inlineScrollMargin`, `scrollPadding`, `blockScrollPadding`, `inlineScrollPadding`
- **Dimension:** `width`, `height`, `blockSize`, `inlineSize`, `flexBasis`, `flexGrow`, `flexShrink`, `flex`
- **Block:** `border`, `blockBorder`, `inlineBorder`, `radius`, `shadow`, `outline`, `padding`, `blockPadding`, `inlinePadding`, `overflow`, `scrollbar`, `textAlign`
- **Color:** `color`, `fill`, `fade`, `image`
- **Flow:** `flow`, `place`, `placeItems`, `placeContent`, `alignItems`, `alignContent`, `justifyItems`, `justifyContent`, `align`, `justify`, `gap`, `columnGap`, `rowGap`, `gridColumns`, `gridRows`, `gridTemplate`, `gridAreas`

## Examples

```jsx
<GridProvider columns={12} gap="1x">
  <Grid columns="repeat(12, $column-width)">
    <Block gridColumn="span 6">Half</Block>
    <Block gridColumn="span 6">Half</Block>
  </Grid>
</GridProvider>
```
