Upgrading
Charts are source files in your project, so an update is something you run, not something that happens to you. This page shows how to see what changed, update, and keep your own changes.
Check your version
The second line of every installed file names its version:
// line-chart.tsx · ChartslibraryUI 1.5.1 · MIT License · Updating replaces this file: …To list the versions in a project at once:
grep -rhoE "ChartslibraryUI( Pro)? [0-9]+\.[0-9]+\.[0-9]+" components/charts | sort | uniq -cOne version everywhere means the chart files and core/ match. Before 1.5.0, the shadcn CLI dropped the version line from core/ files, so a project updated from 1.4 shows 1.5.0 on the charts and no version on the older core files until you update them.
See what changed
- The changelog lists every release, newest first, with new props by name.
- Your AI agent can ask the MCP server:
get_changelogwith your installed version returns only what's newer, plus these steps. - Preview the update without writing anything:
pnpm dlx shadcn@latest add @chartslibraryui/line-chart --dry-runnpx shadcn@latest add @chartslibraryui/line-chart --dry-runyarn dlx shadcn@latest add @chartslibraryui/line-chart --dry-runbunx --bun shadcn@latest add @chartslibraryui/line-chart --dry-runIt lists each file as overwrite (changed), create (new, e.g. a new core file) or skip (identical) (already up to date). To see the lines that change in one file:
pnpm dlx shadcn@latest add @chartslibraryui/line-chart --diff components/charts/line-chart.tsxnpx shadcn@latest add @chartslibraryui/line-chart --diff components/charts/line-chart.tsxyarn dlx shadcn@latest add @chartslibraryui/line-chart --diff components/charts/line-chart.tsxbunx --bun shadcn@latest add @chartslibraryui/line-chart --diff components/charts/line-chart.tsxUpdate
Run the install again with --overwrite, on a clean git working tree so you can review the result:
pnpm dlx shadcn@latest add @chartslibraryui/line-chart @chartslibraryui/bar-chart --overwritenpx shadcn@latest add @chartslibraryui/line-chart @chartslibraryui/bar-chart --overwriteyarn dlx shadcn@latest add @chartslibraryui/line-chart @chartslibraryui/bar-chart --overwritebunx --bun shadcn@latest add @chartslibraryui/line-chart @chartslibraryui/bar-chart --overwrite- Always take
core/with the chart (the command does it for you). A chart from one version with the core from another isn't supported. - "Skipped … (identical)" means that file already matches the latest version. Since 1.5.0 every file carries its version, so a file from an older release is never reported as identical.
- To update every chart you have, list them all in one command, or use the CLI:
npx chartslibraryui add <charts…> --overwrite. - Pro charts update the same way with your key in
components.json(see Installation).
Keep your changes
Updating replaces the chart files, including any edit you made inside components/charts/. The shadcn CLI doesn't merge. Keep customisations where an update can't reach them:
- Props first. Most changes are props:
format,highlight,labelMode,showNotes,words, colours per series. See the Common API. - Theme with CSS variables (
--clui-s1,--clui-grid…) in your own stylesheet, not incore/charts.css. See Theming. - App-wide settings (locale, currency, translated words) go in one
<ChartsProvider>in your layout. See Number formatting. - Wrap, don't edit. Put your defaults in your own component, outside
components/charts/:
// components/revenue-chart.tsx: yours, never overwritten
import { LineChart, type LineChartProps } from "@/components/charts/line-chart";
export function RevenueChart(props: LineChartProps) {
return <LineChart format="currency" zero={false} showNotes="warnings" {...props} />;
}If you did edit a chart file, run --diff first, update, then re-apply your change from the diff (git shows it too).