Installation
Charts install as source files into one folder of your project (by default components/charts/). Every chart needs the shared core/ folder next to it, and all three methods below take care of that.
Requirements: React 18 or 19 and TypeScript (recommended; the files are .tsx). There's no Tailwind requirement and no other runtime dependency.
Option 1: shadcn CLI
If your project is already set up for shadcn/ui (it has a components.json):
npx shadcn@latest add https://chartslibraryui.com/r/line-chart.jsonThis writes components/charts/line-chart.tsx and components/charts/core/*. Add more charts the same way; shared files are reused.
Option 2: the chartslibraryui CLI
A small zero-dependency CLI that works in any project:
npx chartslibraryui add line-chart bar-chartUse --dir to choose another folder (for example --dir src/components/charts). See CLI for every command.
Option 3: copy and paste
- Copy the
core/folder intocomponents/charts/core/. - Copy the chart file (for example
line-chart.tsx) intocomponents/charts/. - Some charts build on others (
pie-chartusesdonut-chart). The chart page lists those files under Source.
Import the theme once
Charts are styled by one CSS file. Import it once, in your root layout or entry file:
// app/layout.tsx (Next.js App Router), or src/main.tsx (Vite)
import "@/components/charts/core/charts.css";Use a chart
import { LineChart } from "@/components/charts/line-chart";
const rows = [
{ month: "Jan", revenue: 1_820_000, plan: 1_800_000 },
{ month: "Feb", revenue: 1_910_000, plan: 1_860_000 },
{ month: "Mar", revenue: null, plan: 1_920_000 }, // missing: drawn as a gap
];
export function Revenue() {
return (
<LineChart
title="Revenue is tracking above plan"
subtitle="Monthly revenue, USD"
data={rows}
x="month"
series={[
{ key: "revenue", label: "Revenue" },
{ key: "plan", label: "Plan", color: "var(--clui-context)", dashed: true },
]}
format="currency"
/>
);
}Charts are client components (they measure their container and handle pointer events). In the Next.js App Router they already start with "use client", so you can render them from server components.
Import aliases
The examples use @/components/charts/.... If your project uses another alias or src/, adjust the import path. Inside the charts, imports are relative (./core/frame), so the folder can live anywhere.
Pro charts
Pro charts come as a download that contains the same folder layout and a local registry. Install them with the CLI pointed at the download:
npx chartslibraryui add waterfall-chart --from ./chartslibraryui-proNo account and no network access are needed. See Free vs Pro.