# CitySkyline (/docs/charts/city-skyline)

CitySkyline answers "how do these groups compare on size, and how activated is each?" — two variables in one row.
**Height** is the primary, precise channel (zero-anchored bars, like a MiniBar); the **lit-window fraction** is a
secondary, low-precision channel you read as "mostly lit, half lit, or dark", not a number. Omit `lit` everywhere and
it's a plain, honest bar row.

```tsx
import { CitySkyline } from "@microcharts/react/city-skyline";

<CitySkyline data={teams} unit="teams" title="Team sizes" />
```

## Install

```tsx
import { CitySkyline } from "@microcharts/react/city-skyline";

<CitySkyline data={teams} unit="teams" title="Team sizes" />
```

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** — team or region size plus an activation read, an org KPI where two variables are the story, or a per-BU
  comparison with utilization.
- **Avoid for** — a single variable (that's `MiniBar`), precise activation reads, or more than about eight groups.


## Variants

```tsx
<CitySkyline data={teams.map(({ label, value }) => ({ label, value }))} />
<CitySkyline data={teams} label="value" />
```

## Edge cases

```tsx
// all-equal values read as a flat roofline — no artificial variation is added
<CitySkyline
  data={[
    { label: "A", value: 30, lit: 0.8 },
    { label: "B", value: 30, lit: 0.4 },
    { label: "C", value: 30, lit: 0 },
  ]}
/>
```

```tsx
// a building under one window row renders as a solid tower — its lit
// fraction still reads on hover and keyboard focus
<CitySkyline
  data={[
    { label: "big", value: 40, lit: 0.8 },
    { label: "tiny", value: 2, lit: 0.9 },
  ]}
/>
```


## Why this default

Windows come on when `lit` is present, because the two-variable read is exactly why this beats a `MiniBar`. Heights are
always zero-anchored bars; the lit windows are quantized to the window count and filled bottom-up, so the activation
reads as a fill level. There is no roofline variation, no antennas, and nothing encoded in building width — width, roof,
and ground are constants, because every mark must earn its place. The secondary channel drops out before the primary: a
building too short for any window row is a solid tower, and its `lit` still shows in the per-building readout on hover
or keyboard focus.

## Accessibility

The accessible name names the count and the tallest — **"3 groups; tallest A at 46."** The interactive entry roves the
buildings with ←/→ (or hover), announcing each on its own: on the team demo at the top of this page, Platform reads
"Platform: 46; 70% lit." — the size precisely, the activation as a percent.

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, lit? }[]` | value = height; lit = 0–1 window fraction. |
| `labels` | `boolean` | Category labels under the buildings. |
| `ground` | `boolean` | The baseline hairline (default true). |
| `label` | `"none" \| "value"` | Numeral above each building. |
| `unit` | `string` | Category noun for the summary (default 'groups'). |
| `bw` | `number` | Building width in viewBox units (default 9). |
| `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).
