Xzero UI
Pro library

Ridgeline

Overlapping distributions, one ridge per group: hover to lift a ridge and read its quartiles, switch datasets and every curve morphs.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/ridgeline
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/ridgeline

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { Ridgeline } from "@/components/xzero/ridgeline/ridgeline";

export function Latency({ regions }: { regions: { id: string; label: string; values: number[] }[] }) {
  return <Ridgeline series={regions} label="API latency by region" unit=" ms" />;
}

API reference

Ridgeline

A ridgeline (joy) plot: one smoothed distribution per row, overlapping like mountain ridges, tinted by median. Hover lifts a ridge above its neighbours to read its quartiles; switching datasets morphs every curve.

PropTypeDefaultDescription
series (required){ id: string; label: string; values: number[] }[]–One ridge per series, drawn top to bottom. Values are raw observations; the ridge is their kernel density.
label (required)string–What is measured. Names the chart for assistive technology.
unitstring–Unit after each value, such as "°" or " ms".
formatValue(value: number) => string–Formats values. Overrides unit.
domain[number, number]–Value range of the axis. Fix it to keep the axis still across datasets. Defaults to the data with room on each side.
overlapnumber2.4How far the tallest ridge rises into the rows above, in row heights.
rowHeightnumber30Height of one row in pixels.
bandwidthnumber–Smoothing in value units. Defaults to Silverman's rule per series.
tintbooleantrueShades each ridge by its median, from a light tint to the full first series color, with a stepped scale under the axis.
activestring | null–Controlled id of the lifted ridge.
defaultActivestring | nullnullInitial lifted ridge when uncontrolled.
onActiveChange(id: string | null) => void–Called when the lifted ridge changes.
emptyLabelstring"No data yet"Shown when there are no values.
classNamestring–Extra class on the root figure.

Keyboard interactions

KeysAction
ArrowUp / ArrowDownLifts the previous or next ridge.
ArrowLeft / ArrowRightMoves the reading cursor along the values by one axis step.
Home / EndLifts the first or last ridge.
EscapeLowers the ridge and clears the reading.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in charts

Guidance for AI tools

Ridgeline: Overlapping distributions, one ridge per group: hover to lift a ridge and read its quartiles, switch datasets and every curve morphs. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components