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.jsonDelivery time by month
RidgelineChartRidgelineTabledefaultRidgelineChartLabels- +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
import { ChartCard } from "@/components/sheenui/charts/chart-parts/chart-card";
import { RidgelineTable, RidgelineChart, type RidgelineGroup } from "@/components/sheenui/charts/ridgeline-chart";
// Package build (after the first npm release, or a packed tarball): import { ChartCard, RidgelineTable, RidgelineChart, type RidgelineGroup } from "@sheenui/theme";
// Raw minutes, one value per order (shortened here)
const data: RidgelineGroup[] = [
{ label: "Nov", values: [44, 51, 38, 62, 47, 55, 41, 49, 58, 46, 52, 43] },
{ label: "Dec", values: [58, 71, 49, 66, 83, 62, 74, 57, 69, 90, 64, 61] },
{ label: "Jan", values: [40, 46, 36, 52, 43, 49, 38, 45, 41, 50, 44, 39] },
];
const minutes = (n: number) => Math.round(n) + " min";
export function Example() {
return (
<ChartCard title="Delivery time" table={<RidgelineTable data={data} format={minutes} />}>
<RidgelineChart data={data} color={7} scale="shared" format={minutes} aria-label="Delivery time by month" />
</ChartCard>
);
}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.tsxcomponents/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
import { RidgelineChart, type RidgelineGroup } from "@/components/sheenui/charts/ridgeline-chart";
// Package build (after the first npm release, or a packed tarball): import { RidgelineChart, type RidgelineGroup } from "@sheenui/theme";
// Raw base salaries in $, one value per person (shortened here)
const salaries: RidgelineGroup[] = [
{ label: "Engineering", values: [118000, 126000, 132000, 141000, 149000, 155000, 163000, 172000] },
{ label: "Design", values: [96000, 104000, 109000, 115000, 121000, 128000, 134000, 140000] },
{ label: "Data science", values: [124000, 133000, 140000, 151000, 158000, 166000, 174000, 185000] },
{ label: "Product", values: [110000, 119000, 128000, 138000, 146000, 153000, 161000, 170000] },
];
const thousands = (n: number) => "$" + Math.round(n / 1000) + "k";
export function Example() {
return (
<RidgelineChart
data={salaries}
fill="sequential"
color={1}
rowHeight={40}
format={thousands}
aria-label="Salary by role"
/>
);
}Props
RidgelineChartLabels keys and English defaults (14)
RidgelineTable props
Keyboard
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
Related pages
48 charts pages in all: browse them on Charts.
By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .