Chart
Responsive frame for a recharts chart. Wraps recharts' ResponsiveContainer,
provides the config (series keys → label / icon / colour) to every
descendant ChartTooltipContent / ChartLegendContent, and injects a
--color-<key> CSS variable per series so recharts marks can be coloured with
fill="var(--color-desktop)". Pass a single recharts chart element as the
child. It is dimensionless - set the aspect / height with className
(defaults to aspect-video).
Usage
Best practices
Colour every series through
config({ desktop: { label, color } }) and referencevar(--color-<key>)on the marks - never hardcode a hex on aBar/Line; that keeps light/dark theming and the legend/tooltip swatches in sync.Reach for
Chartonly to render a recharts data visualization; for a static value + delta useStat, and for a progress bar useProgress.
Props
Chart
ChartLegendContent
ChartStyle
ChartTooltipContent
Also exports
- const
chartAnatomy - type
ChartConfig - component
ChartLegend - component
ChartTooltip