# GardenGrid (/docs/charts/garden-grid)

GardenGrid answers "what's the rhythm of activity over time?" the way ActivityGrid does — but with a single ink. Instead
of color, dot **area** carries a five-step ordinal, so the rhythm reads in grayscale and print where a color heatmap
would collapse. The radius is √-quantized so perceived area steps evenly. A zero cell is a hairline ring (present, but
quiet); a `null` cell is nothing at all, because "missing" is not "zero".

```tsx
<GardenGrid
  data={[12, 20, 8, 0, 15, 28, 34, 5, 0, 22, 18, 9, 3, 0, 24, 30, 11, 6, 19, 0, 26]}
  unit="weeks"
  title="Activity"
  cell={11}
/>
```

## Install

```tsx
import { GardenGrid } from "@microcharts/react/garden-grid";

<GardenGrid data={weeks} title="Activity" unit="weeks" />
```

Setup (package + stylesheet): [Quickstart](/docs/quickstart#set-up-with-an-ai-agent) or paste [`/agent-setup.md`](/agent-setup.md) into your agent.


## When to use it

- **Good for** — a contribution or activity rhythm you print or read in grayscale, a per-repo or per-team activity
  strip, or any calendar-shaped intensity where color isn't available.
- **Avoid for** — exact per-cell values (ActivityGrid with hover, or HeatStrip) or trends (Sparkline).


## Variants

```tsx
const weeks = [12, 20, 8, 0, 15, 28, 34, 5, 0, 22, 18, 9];

<GardenGrid data={weeks} rows={1} />
<GardenGrid data={weeks} empty="blank" />
```

## Edge cases

```tsx
<GardenGrid data={[]} title="No history" />
```

```tsx
<GardenGrid data={[0, 0, 0, 0, 0, 0, 0]} title="Quiet week" />
```

```tsx
<GardenGrid data={[5, null, 8, null, null, 3]} title="Gaps" />
```

```tsx
<GardenGrid data={[12]} title="One" />
```


## Why this default

Rings for zero are the default because print and grayscale lose the zero-versus-missing distinction that color grids get
for free — this chart exists for exactly that medium, so it makes "present but quiet" visible. The radius is √-quantized
so **area** carries the ordinal; a linear radius map would exaggerate the highs quadratically. The steps are ordinal,
not values — the interactive entry announces a cell's step rather than implying a precise read, and `ActivityGrid` is
the color twin when exact values matter.

## Accessibility

The accessible name summarizes the rhythm — **"12 periods; peak 34, 10 active."** The interactive entry walks the grid
in 2-D with the arrow keys (or hover), announcing each cell as its ordinal step — **"3 of 21: 8, step 2 of 5."** — never
a false-precise value, since dot area reads to a step, not a number.

The interactive entry follows the shared [interaction contract](/docs/accessibility#one-interaction-contract):
arrow keys rove between units on both axes, `Home` and `End` jump to the ends, and a click, tap, `Enter` or
`Space` selects a unit — pinning its readout so it survives blur, until you select it again or press `Escape`.
On touch, a tap pins and a drag scrubs.

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `data` (required) | `(number \| null)[]` | Binned values; null = missing. |
| `rows` | `number` | Grid rows (default 7); 1 = strip. |
| `steps` | `3 \| 5` | Radius quantization steps (default 5). |
| `empty` | `"outline" \| "blank"` | How zero cells render (default outline). |
| `unit` | `string` | Noun for the summary count (default "periods"). |
| `animate` | `boolean` | (interactive) Opt-in entrance motion when the chart mounts client-side — add `import "@microcharts/react/motion"` once. Inert on the server, on hydrated server HTML, and under `prefers-reduced-motion`. |

Plus the shared grammar — `data`, `domain`, `color`, `title`, `summary`, `format` — and the layout props (`width`, `height`, `className`, `style`) that every chart accepts. Interactive entries also share `animate` and `live`, and — wherever a chart has more than one navigable unit — `onActive`, `onSelect`, `selectedIndex` and `defaultSelectedIndex`; and — wherever the chart shows a hover value — `readout`. See [the shared grammar](/docs/quickstart#the-shared-grammar).
