Getting started
solid-recharts is a SolidJS 2.0 port of recharts. It keeps the
recharts composable API — you declare a chart, axes, grid, tooltip and series as JSX
children — but the internals are rebuilt on Solid's fine-grained reactivity: no Redux,
no reselect, no virtual DOM re-renders. Updating one data point updates exactly the SVG
attributes that depend on it.
Install
pnpm add solid-rechartssolid-js and @solidjs/web (2.0 beta) are peer dependencies.
Your first chart
A chart is a container (LineChart, BarChart, …) plus the pieces you want, in any
order. Wrap it in ResponsiveContainer to fill the parent element, or give the chart a
fixed width/height.
The composable model
Every chart family works the same way:
| Piece | Role |
|---|---|
LineChart, BarChart, … | Chart container — owns layout, scales and state |
Line, Bar, Area, … | A graphical series bound to a dataKey |
XAxis, YAxis | Axes — categorical or numerical, multiple per chart |
CartesianGrid | Background grid lines |
Tooltip, Legend | Hover info and series legend |
Because components register themselves with the chart context, you can add, remove or reorder them freely — exactly like recharts.
Differences from recharts
- Solid JSX, not React JSX — use
classinstead ofclassName; control flow uses<For>/<Show>instead of.map()when you iterate (e.g.Cellper slice). - SVG props are camelCase —
strokeDasharray,strokeWidthetc., same as recharts. - No
keyprop — Solid doesn't need it. - Smaller bundle — the Redux/reselect state layer is replaced with Solid stores, and heavy utility dependencies were removed.
See also
- LineChart — the first chart family to explore
- ResponsiveContainer — fluid sizing