Native Solid 2 fork of solid-recharts (MIT, © Thomas Guehenneux), derived from Recharts (MIT, © recharts). Adapted documentation; neither project endorses this fork.

Migrating from Recharts

What changes, and what does not, when moving a React Recharts app to Solid.

Component names, composition and base props follow Recharts 3.9.2 as implemented by solid-recharts, with the selected A1–A13 and B1/B2 next-suite adaptations. Most chart JSX can be moved from a React app with mechanical changes; this is not full Recharts 3.10.1 parity.

What stays the same

  • Component names and nesting: <LineChart><XAxis /><Line /></LineChart>
  • dataKey, domain, ticks, stackId, layout, margin, syncId, …
  • camelCase SVG styling props: strokeDasharray, fillOpacity, strokeWidth
  • Tooltip, Legend and Label customization through content and formatter functions
  • Event handlers such as onClick and onMouseEnter on charts and series

Mechanical changes

React (Recharts)Solid (Radix2Solid Charts)
import { … } from "recharts"import { … } from "@wsagency/radix2solid-charts"
className="…"class="…"
data.map((d) => <Cell key={d.id} … />)<For each={data}>{(d) => <Cell … />}</For>
style={{ marginTop: 8 }}style={{ "margin-top": "8px" }}
{cond ? <Tooltip /> : null}<Show when={cond}><Tooltip /></Show>
useState for chart statecreateSignal

Custom content

Render-prop APIs (shape, content, label, tick, dot, activeDot) accept functions that receive the same props object as in Recharts. Solid components run once, so read reactive values inside the JSX you return. Sankey node and link accept functions only.

import { Bar, BarChart, Rectangle } from "@wsagency/radix2solid-charts";
export default () => <BarChart width={400} height={240} data={[{ name: "A", uv: 12 }, { name: "B", uv: 20 }]}>
<Bar dataKey="uv" fill="var(--accent-9)" shape={(props) => <Rectangle {...props} radius={[6, 6, 0, 0]} />} />
</BarChart>;

Selected next-suite APIs

  • Legend accepts position?: CartesianPosition and offset?: number (default 0). Position overrides align/verticalAlign; its default layout="auto" is vertical for left/right and inside-left/right, horizontal otherwise. Only the position-set default-mount path adds wrapper-owned server legend HTML, preserving a zero measured box in first-client styles before browser measurement. No-position and explicit custom-portal legends retain the existing DOM-only path. Inside legends reserve no plot space. See LineChart.
  • XAxis height="auto" starts at 30px on the server and first client render, then measures rotated ticks and string labels after mount. Requested numeric heights and tick positions remain unchanged, but corrected shared server plot clips can change SSR markup. Automatic height is not server-final geometry; see SSR.
  • Sankey accepts title, desc, and accessibilityLayer; see its live accessible example.

Controlled Brush is intentionally different

A Brush with controlled startIndex/endIndex keeps its dragged slide position after mouseup even when the parent leaves those props unchanged, and retains controlled indices across data changes. This preserves imported Recharts behavior; it is not the parent-authoritative refusal contract used by the new Combobox, Command, Tree, and Splitter Primitives. Do not use a refused Brush update as a guard for an action.

Not available

  • Customized (render a plain child component instead)
  • React element cloning patterns
  • Treemap update animation: Treemap has no isUpdateAnimationActive prop; only the entry animation runs
  • Full Recharts 3.10.1 parity, CartesianGrid theme support, and canary APIs. Only the named selected adaptations and two ReduceCSSCalc fixes are in the published 0.1.0-rc.3 release candidate.