Kinetik UI

Bar Chart

.md

Bars that spring up in a wave; drag across them and the one under the finger stays bright with its value.

v1.0.0Live on webreact-native-gesture-handlerreact-native-reanimatedreact-native-worklets
Component preview

Installation

Kinetik CLI
npx kinetik-ui add bar-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/bar-chart.json

Install manually

  1. Install dependencies
    npx expo install react-native-gesture-handler react-native-reanimated react-native-worklets
  2. Copy the source files
    • components/kinetik/bar-chart.tsx
    View source files

Usage

import { BarChart } from '@/components/kinetik/bar-chart';

<BarChart
  accessibilityLabel="Steps this week"
  data={days.map((d) => ({ label: d.short, value: d.steps }))}
  formatValue={(v) => v.toLocaleString()}
  onSelect={setDay}
/>;

The chart fills its parent's width and spaces the bars evenly. Bars grow from zero in a wave the first time and spring to new values when data changes. Pass max to keep the scale fixed across datasets, for example a daily goal.

When to use

  • Comparing a handful of categories or periods: days, months, teams, products.
  • Summaries where the exact value matters on demand but not all at once.

When not to use

  • Continuous trends with many points. Use Line Chart.
  • More than about 16 bars; they get too thin to touch.

Notes

  • The selection stays after the finger lifts; tap the selected bar to clear it.
  • A tick plays as the finger crosses from bar to bar.
  • Screen readers move between bars with the adjustable actions.

Props

BarChartProps

PropTypeDefaultDescription
datarequiredreadonly BarDatum[]—
accessibilityLabelrequiredstring—A summary of what the chart shows, e.g. "Steps per day this week".
heightnumber180Height of the bars' area. Defaults to 180.
colorstring—Bar colour. Defaults to the theme ember.
maxnumber—The value the tallest bar reaches. Defaults to the largest value.
formatValue(value: number) => string(v) => String(v)
onSelect(index: number | null) => void—Called with the selected bar, or null when the selection clears.
hapticsbooleantrueA tick as the finger moves from bar to bar. Defaults to true.
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
One spring per bar when values change and one opacity timing per bar when the selection changes, all on the UI thread.
Measured

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

Real-device measurement pending.

Accessibility

Reduced motion
Bars reach their height with a short timing instead of the wave of springs.
Screen readers
Adjustable: swipe up and down to move between bars; each reads its label and value.
Touch target
The whole chart is the scrub area; each bar's column is a target.

Source files

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