Ridgeline
Overlapping distributions, one ridge per group: hover to lift a ridge and read its quartiles, switch datasets and every curve morphs.
npx shadcn@latest add @silicon-ui/ridgelineInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/ridgelineManually
Install the dependencies
npm install motionCopy these files into your project
- components/silicon-ui/ridgeline/ridgeline.tsx
- components/silicon-ui/ridgeline/ridgeline.module.css
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
| Prop | Type | Default |
|---|---|---|
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 | — |
unitUnit after each value, such as "°C". | string | "" |
formatValue | (value: number) => string | — |
domainValue range of the axis. Defaults to the data with a little room on each side. | [number, number] | — |
overlapHow far a ridge may rise into the rows above, in row heights. | number | 2.4 |
rowHeightHeight of one row in pixels. | number | 30 |
bandwidthSmoothing in value units. Defaults to Silverman's rule per series. | number | — |
tintShades each ridge by its median, from a light tint to the full first series color, and shows the scale under the axis. | boolean | true |
activeControlled id of the lifted ridge. | string | null | — |
defaultActive | string | null | null |
onActiveChange | (id: string | null) => void | — |
emptyLabel | string | "No data yet" |
ref | Ref<HTMLElement> | — |
className | string | — |
Dependencies
- npm
- motion
- Registry
- silicon-motion-tokens