Kinetik UI

Slope Chart

.md

Before and after on two axes: lines draw in, rises in blue, and new data slides every end to its new place.

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

Installation

Kinetik CLI
npx kinetik-ui add slope-chart

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/slope-chart.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/slope-chart.tsx
    View source files

Usage

import { SlopeChart } from '@/components/kinetik/slope-chart';

<SlopeChart
  accessibilityLabel="Share of trips"
  fromLabel="2025"
  toLabel="2026"
  series={[
    { label: 'Lisbon', from: 24, to: 31 },
    { label: 'Kyoto', from: 30, to: 22 },
  ]}
  formatValue={(v) => `${v}%`}
/>;

Each series is one line from its from value on the left to its to value on the right. The right-hand label shows the new value and the change.

When to use

  • Comparing two moments for a handful of items: this year against last, before and after a change.
  • When the direction and size of each change matters more than the path between.

When not to use

  • More than eight or so series. Labels crowd and lines tangle; use a sorted bar chart of the change.
  • Values over many points in time. Use Line Chart.

Notes

  • Labels on each side are spread apart so they never overlap, while dots stay at their true values.
  • Change series and every end slides to its new place on a spring. Lines are keyed by label.
  • Tap a label to bring that line forward and dim the rest; tap it again to clear.
  • With reduced motion the lines appear drawn and move without springs.

Props

SlopeChartProps

PropTypeDefaultDescription
seriesrequiredreadonly SlopeSeries[]—
accessibilityLabelrequiredstring—What the chart shows, read first, e.g. "Share of trips by city".
fromLabelstring'Before'Heading over the left column. Defaults to 'Before'.
toLabelstring'After'Heading over the right column. Defaults to 'After'.
formatValue(value: number) => string(v) => String(Math.round(v))Formats values beside the dots. Defaults to whole numbers.
heightnumber240Plot height, without the headings. Defaults to 240.
testIDstring—
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
One Skia canvas of lines and dots, driven by four shared values per series; labels are plain text placed by springs. Nothing runs at rest.
Measured

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

Real-device measurement pending.

Accessibility

Reduced motion
Lines appear drawn and move straight to new values.
Screen readers
One image whose name reads the title, both column headings and every series from start to end value.
Touch target
Labels take taps with 13 pt of slop above and below, so 44 pt rows.

Source files

components/kinetik/slope-chart.tsx is in the Code tab of the preview above.