What problem does it solve?
Prevents incorrect or non-theme-aware Recharts usage when building charts with the shadcn Chart primitive, which can lead to dark mode color failures, missing CSS variables, and RSC/client boundary errors.
Core Features & Use Cases
- ChartConfig-driven theming: injects
--color-<dataKey> series CSS variables so all chart series follow the active light/dark theme.
- Correct wrapper usage: uses
ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, and ChartLegendContent instead of raw Recharts tooltip/legend.
- RSC-safe client boundaries: enforces adding
'use client' for any component importing chart wrappers to avoid Next.js App Router failures.
- Reliable rendering guarantees: ensures
ChartContainer has an explicit height contract to avoid zero-height charts.
- Chart-type composition guidance: maps Bar/Line/Area/Pie/Radar/Scatter/Composed/RadialBar to the correct Recharts root components and required children.
Quick Start
Install the chart component with npx shadcn@latest add chart, then implement a Client Component that wraps your Recharts chart in ChartContainer with a correct ChartConfig and uses ChartTooltipContent and ChartLegendContent.