# PartitionStrip (/docs/charts/partition-strip)

PartitionStrip answers "what is the whole made of — and what are the big parts made of — with parentage visible?".
Parents sit on the top row with widths proportional to their share of the whole, and each parent's children tile the
exact x-range beneath it. Two aligned rows beat a treemap because alignment is the comparison channel — and two levels
is a hard limit, because deeper hierarchies become unreadable texture at this size.

```tsx
import { PartitionStrip } from "@microcharts/react/partition-strip";

<PartitionStrip
  data={[
    {
      label: "JS",
      children: [
        { label: "react", value: 28 },
        { label: "vendor", value: 12 },
        { label: "app", value: 8 },
      ],
    },
    {
      label: "CSS",
      children: [
        { label: "tailwind", value: 16 },
        { label: "custom", value: 8 },
      ],
    },
    { label: "img", value: 18 },
    { label: "font", value: 10 },
  ]}
  title="Bundle composition"
/>
```

## Install

```tsx
import { PartitionStrip } from "@microcharts/react/partition-strip";

<PartitionStrip data={bundle} title="Bundle composition" />
```

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** — bundle / storage / budget composition, two-level breakdowns.
- **Avoid for** — deep hierarchies (unreadable at this size) or flat parts (SegmentedBar).


## Variants

```tsx
<PartitionStrip
  data={[
    {
      label: "JS",
      children: [
        { label: "react", value: 28 },
        { label: "vendor", value: 12 },
        { label: "app", value: 8 },
      ],
    },
    {
      label: "CSS",
      children: [
        { label: "tailwind", value: 16 },
        { label: "custom", value: 8 },
      ],
    },
    { label: "img", value: 18 },
  ]}
  emphasis="react"
/>
```

## Edge cases

```tsx
// no node has children → the parent row alone carries the whole chart,
// the child row stays empty
<PartitionStrip
  data={[
    { label: "img", value: 18 },
    { label: "font", value: 10 },
    { label: "css", value: 6 },
  ]}
  title="Flat parts"
/>
```

```tsx
// squeezed into an 18px row, the parent row can't seat the floor font —
// labels drop cleanly instead of overlapping (width here is generous;
// height is the gate)
<PartitionStrip
  data={[
    {
      label: "JS",
      children: [
        { label: "react", value: 28 },
        { label: "vendor", value: 12 },
      ],
    },
    { label: "CSS", children: [{ label: "tailwind", value: 16 }] },
  ]}
  height={18}
/>
```


## Why this default

Two aligned rows because alignment is the comparison — you can see at a glance that a child sits under its parent and
how much of it that child is. A treemap discards that alignment and a flat SegmentedBar discards the hierarchy entirely.
Grandchildren are ignored with a dev warning, on purpose: three levels of nesting at 24px is texture, not information.

## Accessibility

The accessible name names the biggest leaf and its parent — **"3 groups, 5 parts; largest JS → react (31% of the
whole)."** The interactive entry roves within a row with ←/→ and moves between a parent and its children with ↑/↓,
announcing each node's share of the whole and of its parent.

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) | `{ label, value?, children? }[]` | Two-level hierarchy. |
| `emphasis` | `string` | Accents one node and its lineage. |
| `labels` | `boolean` | Parent-row labels with size drop-out. |
| `colors` | `string[]` | Per-group colours, cycled; overrides --mc-cat-N. Accent/neutral roles keep. |
| `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).
