Kinetik UI

Ridgeline

.md

Overlapping distributions that rise one by one; tap a row to lift its ridge and mark its quartiles.

v1.0.0Live on web@shopify/react-native-skiareact-native-reanimatedreact-native-worklets
Component preview

Installation

Kinetik CLI
npx kinetik-ui add ridgeline

The CLI copies the source and installs native dependencies with npx expo install, so versions match your Expo SDK. With shadcn: npx shadcn@latest add https://kinetik-ui.dev/r/ridgeline.json

Install manually

  1. Install dependencies
    npx expo install @shopify/react-native-skia react-native-reanimated react-native-worklets
  2. Copy the source files
    • components/kinetik/ridgeline.tsx
    View source files

Usage

import { Ridgeline } from '@/components/kinetik/ridgeline';

<Ridgeline
  accessibilityLabel="Commute times by city, in minutes"
  groups={[
    { key: 'lis', label: 'Lisbon', values: lisbonMinutes },
    { key: 'ber', label: 'Berlin', values: berlinMinutes },
  ]}
  domain={[0, 100]}
  formatValue={(v) => `${Math.round(v)} min`}
/>;

When to use

  • Comparing how values are spread across a few groups: response times by region, prices by category, scores by class.
  • Showing that two groups with the same average behave differently.

When not to use

  • A single number per group. Use Bar Chart.
  • Very few samples per group (under ten or so); the smoothed curve would suggest a shape the data does not have.

Notes

  • Pass raw samples: each ridge is a Gaussian kernel density estimate, scaled against the tallest ridge so heights compare fairly.
  • Ridges overlap upwards; ground should match the colour behind the chart so the ones in front stay solid.
  • Tap a row to lift its ridge and mark its quartiles; the readout and each row's label give the median and middle half for screen readers.
  • With reduced motion the ridges appear at full height and do not lift.

Props

RidgelineProps

PropTypeDefaultDescription
groupsrequiredreadonly RidgeGroup[]—
accessibilityLabelrequiredstring—What the chart shows, e.g. "Commute times by city".
domainreadonly [number, number]—The range on the x axis. Defaults to the range of all samples.
formatValue(value: number) => string(v) => String(Math.round(v))Formats values on the axis, in the readout and for screen readers.
groundstring—The colour behind the chart, used to keep ridges in front solid. Defaults to the theme surface.
hapticsbooleantrueA tick when a ridge is lifted. Defaults to true.
testIDstring—
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
One Skia canvas; curves are estimated once per dataset and each ridge moves by a group transform on three shared values. Nothing runs at rest.
Measured

Pixel 9 emulator, API 35, release build · interaction median 1.00× the system Settings app on the same emulator (indicative only) · no frames drawn at rest · 156 MB app memory

Real-device measurement pending.

Accessibility

Reduced motion
Ridges appear at full height and the chosen one does not lift.
Screen readers
Each row is a button that reads the group, its median and its middle half, with a selected state.
Touch target
Rows are 44 pt tall and span the full width.

Source files

components/kinetik/ridgeline.tsx is in the Code tab of the preview above.