Skip to content

Ridgeline

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

DataChartNew
npx shadcn@latest add @silicon-ui/ridgeline

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/ridgeline

Manually

  1. Install the dependencies

    npm install motion
  2. Copy these files into your project

    • components/silicon-ui/ridgeline/ridgeline.tsx
    • components/silicon-ui/ridgeline/ridgeline.module.css
  3. Add the foundation, once per app, for the design and motion tokens

    npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

usage.tsx
import { Ridgeline } from "@/components/silicon-ui/ridgeline/ridgeline";

API reference

PropTypeDefault
series*

One ridge per series, drawn top to bottom.

RidgelineSeries[]—
label*

What is measured, such as "Daily highs in Zurich". Names the chart for assistive technology.

string—
unit

Unit after each value, such as "°C".

string""
formatValue(value: number) => string—
domain

Value range of the axis. Defaults to the data with a little room on each side.

[number, number]—
overlap

How far a ridge may rise into the rows above, in row heights.

number2.4
rowHeight

Height of one row in pixels.

number30
bandwidth

Smoothing in value units. Defaults to Silverman's rule per series.

number—
tint

Shades each ridge by its median, from a light tint to the full first series color, and shows the scale under the axis.

booleantrue
active

Controlled id of the lifted ridge.

string | null—
defaultActivestring | nullnull
onActiveChange(id: string | null) => void—
emptyLabelstring"No data yet"
refRef<HTMLElement>—
classNamestring—

Dependencies

npm
motion
Registry
silicon-motion-tokens