Working notes for agents (and humans) contributing to this repository.
react-chartjs-2 is a thin React wrapper around Chart.js: a <Chart> component, typed components per chart type (<Line>, <Bar> and others) and a few event helpers. Chart.js does the drawing; this package only connects its lifecycle and data updates to React.
- Stay thin. Anything Chart.js already does belongs to Chart.js. New props and options are added only when they cannot be expressed through Chart.js
options,pluginsor a ref to the chart instance. - Bundle size matters. The package is tree-shakeable and its size is a tested contract (
.size-limit.json): a consumer pays only for the components they import. Follow thetree-shakingandsize-limitskills. - Compatibility is part of the API. The package supports every React version from the
peerDependenciesrange. Since v6 it ships only the ES module build, which Node.js 20.19+ and 22.12+ can alsorequire(). Narrowing either is a breaking change.
src— the library sources; unit tests live next to them as*.spec.tsx(see theunit-testsskill).stories— Storybook stories, the place to check a component by eye.sandboxes— standalone example apps. The documentation website builds them into its example pages, and StackBlitz opens them straight from GitHub, so each sandbox keeps its ownpackage.jsonwith dependencies from npm.website— the documentation website, https://react-chartjs-2.js.org.