BarChart

BarChart is an animated bar chart component for React Native and React, from the dissolve library. Bar chart you scrub with a finger, sliding bubble, bars regrow on period change.

A bar chart built from small round dots, a slightly jittered grid with a rounded top per bar. The dots fly in and assemble the bars with a short stagger. Scrub with a finger: the bar under it stays lit while the others step back, a bubble with the value slides along, and the dots near the finger scatter away, then spring back. New data sends the dots falling from the old bars and gathers them into the new ones. Stacked series use the chart tokens: pink, violet and yellow.

Install

React Native

Install the engine once per app and wrap the root layout in <DissolveProvider> (see Installation), then copy the component into components/dissolve:

npx expo install dissolve-ui @shopify/react-native-skia react-native-reanimated react-native-worklets react-native-gesture-handler expo-haptics
npx dissolve-ui add bar-chart --native
npx shadcn@latest add https://dissolve.rselmi.com/r/native/bar-chart.json

React

Needs React 19 and react-dom, nothing else: no engine, no provider, no Tailwind. Works in the Next.js App Router.

npx dissolve-ui add bar-chart --web
npx shadcn@latest add https://dissolve.rselmi.com/r/bar-chart.json

Usage

BarChart.tsx (React Native)
import { BarChart } from '@/components/dissolve/bar-chart';

<BarChart
  data={[{ label: 'Mon', value: 8412 }, { label: 'Tue', value: 10230 }]}
  formatValue={(v) => `${v.toLocaleString()} steps`}
  onSelect={(i) => setDay(i)}
/>

<BarChart stacked maxDots={1000} data={[{ label: 'Jan', values: [42, 18, 30] }]} />
BarChart.tsx (React)
import { BarChart } from '@/components/dissolve/bar-chart';

<BarChart
  data={[{ label: 'Mon', value: 8412 }, { label: 'Tue', value: 10230 }]}
  formatValue={(v) => `${v.toLocaleString()} steps`}
  onSelect={(i) => setDay(i)}
/>

<BarChart stacked maxDots={1000} data={[{ label: 'Jan', values: [42, 18, 30] }]} />

Props

PropTypeDefaultDescription
data{ label, value?, values? }[]requiredOne bar per item. values are segments, bottom to top. Pass a stable array: new data replays the gather.
heightnumber180Plot height. The bubble lane and labels come on top.
formatValue(value: number) => stringgroupedText of the bubble.
formatAxis(value: number) => stringcompactAxis labels, e.g. 1.2k.
onSelect(index: number | null, datum?) => voidBar under the finger, then null on release.
stackedbooleanfalseDraws values as stacked segments.
colorsBarToken[]['primary']Segment colors as theme tokens. ['chart-1', 'chart-2', 'chart-3'] (pink, violet, yellow) when stacked.
barRadiusnumber6Rounding of the top of each dot column.
maxDotsnumber1400Dot budget for the whole chart, the grid gets coarser past it. At most 1600.
gapnumber6Space between bars, shrinks on dense charts.
labelEverynumberOne label every N bars. Default: all up to 12 bars.
axisbooleantrueValue axis on the right.
hapticsbooleantrueA tick per bar change while scrubbing.
classNamestringRoot classes (margins, padding...).
bubbleClassNamestringBubble classes (background, radius...).

Source

Previous: RulerPicker · Next: MiniPlayer · All components

dissolve is MIT licensed. Source on GitHub, package on npm. This page as markdown. For AI agents: llms.txt.