Skip to content

Ridgeline Chart for React

A React ridgeline chart stacks overlapping density ridges, one per group, to show how a spread shifts between groups. Pass data as readonly RidgelineGroup[]: one group per ridge, top to bottom, each with its raw values.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/ridgeline-chart.json

Delivery time by month

Use the arrow keys to read each distribution.

  • RidgelineChart
  • RidgelineTable
  • defaultRidgelineChartLabels
  • +1 more

Delivery times by month

220 orders a month. Deliveries got faster and more predictable, apart from the December rush. Hover, tap or arrow through the months; switch the scale to give every ridge the same peak.

Delivery time

Minutes from order to door, Nov 2025 to Oct 2026, by month

Files to copy

16 folders · 34 files · 4 packages
From theme/src/
  • components/charts/{ridgeline-chart.tsx, category-bar.tsx, chart-export-menu.tsx, chart-export.ts, chart-figure.tsx, chart-fit.tsx, chart-icons.tsx, chart-parts.tsx, chart-patterns.tsx, chart-pointer.tsx, chart-tip.tsx, chart-utils.ts, heatmap.tsx, streamgraph.tsx}
  • components/button/
  • components/charts/category-bar/
  • components/charts/chart-parts/
  • components/charts/heatmap/
  • components/charts/streamgraph/
  • components/drawer/parts/sheet.tsx
  • components/kbd/
  • components/menu/
  • components/skeleton/
  • components/spinner/
  • components/status-icons/
  • hooks/{use-controllable.ts, use-direction.ts, use-intersection.ts, use-latest.ts, use-magnetic.ts, use-media-query.ts, use-preferences.ts}
  • motion/{gate.ts, tokens.ts}
  • lib/{cn.ts, csv.ts, form.ts, glide-highlight.tsx, heading.ts, math.ts, popup-a11y.ts, popup-motion.ts, state-light.tsx, warn-once.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/ridgeline-chart.jsonRegistry item: ridgeline-chart. The styles need the Tailwind v4 glass UI setup.
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Next.js: samples here pass functions (formatters, seriesLegend, a dashboard's load), so put them in a file that starts with "use client".

Sequential fill

fill="sequential" paints each ridge with a light → dark ramp along the value axis, so position and color agree: here, salary bands by role.

Salary by role

Base salary, 160 people per role

Props

PropTypeDefaultDescription
data (required)readonly RidgelineGroup[]NoneOne group per ridge, top to bottom, each with its raw values.
colorChartColor1Palette slot for the ridges (one hue: position and name tell them apart).
fill"series" | "sequential""series""series": each ridge in its colour. "sequential": filled with a light → dark ramp along the value axis.
bandwidthnumberSilverman's rule, per groupSets the kernel bandwidth in value units.
domain[number, number]the data, padded by the widest bandwidthSets the value axis range.
scale"shared" | "each""shared""shared" (default): one density scale, so a tight distribution stands taller. "each": every ridge peaks at the same height.
overlapnumber2How far a ridge may rise into the rows above, in rows.
rowHeightnumber34Sets the height of each row, in px.
showMedianbooleantrueDraw a tick at each group's median.
format((n: number) => string)formatCompact in localeFormats a value for the labels, tooltips and data table: takes the number, returns the text shown.
localestring"en"Locale of the default number format.
emptyStateReactNodeNoneShown when there is nothing to plot.
labelsPartial<RidgelineChartLabels>defaultRidgelineChartLabelsEvery other string, for translation: labels={{ instructions: "…" }}; omitted keys keep the English of defaultRidgelineChartLabels. All 14 keys of RidgelineChartLabels are listed in the key table under the props table.
aria-label (required)stringNoneAccessible summary of what the chart shows.
classNamestringNoneAdds extra classes to the outer element.
RidgelineChartLabels keys and English defaults (14)
Pass any key in labels; the rest keep the defaults of defaultRidgelineChartLabels.
KeyEnglish default
instructionsUse the arrow keys to read each distribution.
medianmedian
meanmean
middlemiddle 50%
rangerange
countvalues
between(low, high) => (/^[-−]/.test(low) || /^[-−]/.test(high) ? `${low} – ${high}` : `${low}–${high}`)
groupGroup
minMin
maxMax
p2525th pct
p7575th pct
touchHintTap a ridge to read its distribution
emptyNo data

RidgelineTable props

PropTypeDefaultDescription
data (required)readonly RidgelineGroup[]NoneOne group per ridge, top to bottom, each with its raw values.
format((n: number) => string)formatCompact in localeFormats a value for the labels, tooltips and data table: takes the number, returns the text shown.
labelsPartial<RidgelineChartLabels>defaultRidgelineChartLabelsEvery other string, for translation: labels={{ instructions: "…" }}; omitted keys keep the English of defaultRidgelineChartLabels. All 14 keys of RidgelineChartLabels are listed in the key table under the props table.
localestring"en"Locale of the default number format.
captionstringNoneVisually hidden caption that names the table.

Keyboard

KeysAction
TabFocus the chart (one tab stop).
↓/→Next ridge.
↑/←Previous ridge.
Home/EndFirst / last ridge.
EscapeStop reading.

Accessibility

  • The chart is one focusable figure; each ridge read by keyboard announces its median, mean, middle 50%, range and count once.
  • Group names sit in their own column, never under a curve, and the active name turns bold: the ridges never rely on color to be told apart.
  • The table view gives each group's count, five-number summary and mean: the exact numbers behind every curve.
  • Forced colors draw every outline and median tick in CanvasText; reduced motion draws the ridges in place.

All exports on this page

  • RidgelineChart — Distributions stacked as overlapping ridges (a joyplot): how a measure is spread in each group.
  • RidgelineTable — Each group's count, five-number summary and mean.
  • defaultRidgelineChartLabels — The built-in English strings of RidgelineChart; spread it into your own labels and change what you need.

When to use the ridgeline chart

  • Use it as a joy plot to compare how a measure is distributed across groups, such as monthly delivery times where you want to see both the typical time and how much spread there is.
  • It suits showing change in spread over time, for example orders getting faster and more predictable month by month apart from a December rush.
  • Try fill sequential for salary bands by role, where a light to dark ramp along the value axis means position and color say the same thing.
  • Skip it when you have only a few observations per group or need exact quartiles; BoxPlot states them directly, and Histogram shows one distribution in detail with real bin counts.
  • Pair it with ChartCard and its Chart / Table tabs, RidgelineTable for the count, median, mean and range as text, and a segmented control to switch between shared and each scale.

Frequently asked questions

48 charts pages in all: browse them on Charts.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .