# Ridgeline

A React component in [Beamline](https://beamline.io/)'s [Charts & data-vis](https://beamline.io/components/charts) category. Live demo: https://beamline.io/components/ridgeline

Distributions per group as overlapping density ridges (response time by region, order size by plan): an overlap control, median and p95 readouts per row, hover or focus a ridge to bring it forward with its markers, and hatched rows for groups that were not measured.

## Use it for

- Comparing the shape of a distribution between groups: latency by region, deal size by segment, session length by plan.

## Not for

- One total per group ([bar-chart](https://beamline.io/components/bar-chart)).
- A percentile over time ([line-chart](https://beamline.io/components/line-chart)).

## Anatomy

- title, description, overlap switch (actions), table button
- row labels (buttons, one per group)
- ridges (density area per group, sharing one scale)
- median and p95 markers on the active ridge
- row summary (p50 · p95) at the end of each row
- value axis with ticks and grid
- hatched row for an unmeasured group

## Variants

- **0**: overlap: any number of row heights through the prop; the built-in switch offers none 0 · low 0.5 · medium 1 · high 2 and can be hidden
- **1**: domain and bandwidth fixed or from the data
- **2**: color per group (series palette by default)

## States

- loading (skeleton)
- empty
- unmeasured group (values null or empty): hatched row, “Not measured”
- active ridge (lifted, outlined, markers shown, others dimmed)
- table view (samples, median, p95, min, max per group)
- narrow: the row summary moves to a readout under the axis
- right-to-left: the value axis still runs left to right

## Keyboard

- Tab focuses the active (or first) row label; ↑/↓ move between groups, Home/End to the first/last
- Focus or hover lifts that ridge; Escape releases it
- Overlap switch: ← → choose a preset (radio group)

## Motion

Ridges rise from their baselines once; a change of overlap or the active ridge is immediate. Nothing moves under reduced motion.

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `data` | `RidgelineGroup[]` | — | { key, label, values: (number \| null)[] \| null, color? } top to bottom. Null samples are skipped; a null or empty list is an unmeasured group. |
| `format` | `(value: number) => string` | — | How values read on the axis, markers and table: "182 ms". |
| `domain` | `[number, number]` | — | Axis range; the data with room on each side by default. |
| `bandwidth` | `number` | — | Smoothing in value units; Silverman's rule per group by default. |
| `overlap / defaultOverlap / onOverlapChange` | `number` | — | How far a ridge rises into the rows above, in row heights. Default 1. |
| `overlapControl` | `boolean` | — | Show the overlap switch in the header. Default true. |
| `height` | `number` | — | Plot height; about 34 px per group by default. Rows share it, so more overlap means taller ridges, not a taller chart. |
| `active / defaultActive / onActiveChange` | `string \| null` | — | The lifted group's key. |
| `title / hideTitle / description` | `string / boolean / ReactNode` | — | The figure's name (a heading unless hidden) is always its accessible name. |
| `table` | `boolean` | — | Offer “View as table”. Default true. |
| `loading` | `boolean` | — | Skeleton of the chart's shape; keeps the frame's size. |
| `actions` | `ReactNode` | — | Controls beside the legend (range, offset). |
| `className` | `string` | — | Lands on the figure. |
| `classNames` | `ChartClassNames` | — | Frame, tooltip and slice-list parts as applicable to this chart. |
| `style / ref` | `CSSProperties / Ref<HTMLElement>` | — | The native chart figure; layout measurement refs stay internal. |

## Dependencies

`motion`

## Import

```tsx
import { Ridgeline } from "@/components/ridgeline/ridgeline";
```

## Get it

Ridgeline is part of Beamline: 190 React components and screens your coding agent (Claude Code, Codex, Cursor or any MCP client) installs into your app through Beamline's MCP server, as a ready-built package or as plain React source you can change. $49 one payment (regular $200), no subscription, a year of updates, one licence for your whole team. [Get Beamline](https://beamline.io/checkout?pack=complete) · [Connect your agent](https://beamline.io/connect)

## More in Charts & data-vis

- [Activity heatmap](https://beamline.io/components/activity-heatmap): A calendar of daily counts, one cell per day on a sequential ramp: weeks across, weekdays down, month and weekday labels, a legend scale, hatched days…
- [Area chart](https://beamline.io/components/area-chart): Amounts over time as filled areas: overlapping, stacked or as shares of 100%, five fills, two strokes, five curves, a range handle; gaps for missing…
- [Bar chart](https://beamline.io/components/bar-chart): Amounts by category as bars: columns or rows, grouped, stacked or as shares, reference lines, five looks (rounded, cells, trace, isometric, monospace), a…
- [Composed chart](https://beamline.io/components/composed-chart): Different measures on one time axis: bars, lines and areas per series, a left and a right value axis with their own formats, and reference lines.
- [Gauge](https://beamline.io/components/gauge): One value against a known range: a semicircle, a 270° dial or a full ring, filled or with a needle, coloured bands with their names (healthy, busy…
- [Line chart](https://beamline.io/components/line-chart): Values over time as lines: curves, point markers, dashed series for forecasts, reference lines for limits and targets, an optional zero baseline and a…
- [Pie chart](https://beamline.io/components/pie-chart): A few shares of a whole as a pie or donut, with spaced slices, percent labels, a centre readout and a list of every slice with value and share; hovering…
- [Radar chart](https://beamline.io/components/radar-chart): A few series compared across the same five to eight dimensions as polygons on a polygon or circle grid; hover or arrow keys pick a dimension and read…
- [Radial chart](https://beamline.io/components/radial-chart): Progress of a few measures toward their targets as concentric rings, full or half circle, with a centre readout and a list of each ring's value, target…
- [Sankey chart](https://beamline.io/components/sankey-chart): Flows between stages as bands whose width is the amount: sources to pages to outcomes, budgets to teams; hovering or focusing a node lights its flows and…
- [Slope chart](https://beamline.io/components/slope-chart): Change between two points in time per item, by value or by rank: labels on both sides that never collide, rising and falling told by the end marker (▲ ▼)…
- [Sparkline](https://beamline.io/components/sparkline): A compact trend beside its value: point along it or focus it and use ← → to read each point; nulls are gaps. TrendLine is the bare line.
- [Streamgraph](https://beamline.io/components/streamgraph): Stacked flows over time around a centre baseline, with silhouette, wiggle, expand (shares) and zero offsets: a legend that turns layers on and off, a…
- [Treemap](https://beamline.io/components/treemap): Nested rectangles sized by value (spend by team, then service), squarified so tiles stay close to square: labels that fit or hide, hover and focus…
- [Waffle chart](https://beamline.io/components/waffle-chart): Units of a whole as a grid of cells by category (seats used of a plan, tickets by channel): a 10×10 grid by default, hatched cells for units whose…
