Components
Charts
Declarative SVG and WebGL charts: Cartesian, pie, radial, radar, gauge, sparkline, funnel, and Sankey with zoom, sampling, keyboard focus, and Excel or image export.
@composerkit/charts renders Cartesian (bar, line, scatter, rangeBar, ohlc, heatmap), PieChart, RadialBarChart, RadialLineChart, RadarChart, FunnelChart, SankeyChart, Gauge, and SparkLineChart on one shared keyboard-navigable frame powered by --chart-* tokens.
For renderer choices (svg, svg-batch, webgl), zoom and sampling, CSP-safe export, and when to use @composerkit/data-grid's canvas charts instead, read the Charts guide.
Loading the component gallery…
Install
shadcn registry
npx shadcn@latest init --defaults --yesnpx shadcn registry add '@composerkit=https://composerkit.dynd.ai/r/{name}.json'npx shadcn add https://composerkit.dynd.ai/r/charts.json --overwrite{+{+ "registries": {+ "@composerkit": "https://composerkit.dynd.ai/r/{name}.json"+ }+}}Import
import { CartesianChart } from "@/components/charts/cartesian-chart";Demo code
"use client";import { CartesianChart } from "composerkit/components/charts/cartesian-chart";import { Gauge } from "composerkit/components/charts/gauge";import { PieChart } from "composerkit/components/charts/polar";import { SparkLineChart } from "composerkit/components/charts/sparkline";import { useState } from "react";import { AppearanceControl } from "@/components/appearance-control";const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"];const REVENUE_SERIES = [ { data: [42, 51, 48, 63, 71, 79], id: "revenue", label: "Revenue", type: "bar" as const, }, { curve: "monotone" as const, data: [30, 36, 39, 46, 52, 60], id: "target", label: "Target", type: "line" as const, },];const SHARE_SLICES = [ { id: "chat", label: "Chat", value: 44 }, { id: "grid", label: "Data grid", value: 28 }, { id: "charts", label: "Charts", value: 18 }, { id: "scheduler", label: "Scheduler", value: 10 },];const SPARK_VALUES = [14, 18, 16, 22, 27, 25, 31, 35];export const ChartsGalleryExample = () => { const [metric, setMetric] = useState<"revenue" | "spark">("revenue"); return ( <main className="gallery"> <header className="flex flex-wrap items-center justify-between gap-4"> <div> <h1>Charts</h1> <p className="text-sm text-muted-foreground"> SVG cartesian, polar, gauge, and sparkline charts styled with ComposerKit design tokens. </p> </div> <AppearanceControl id="charts-gallery-appearance" /> </header> <section className="flex flex-col gap-4"> <div className="flex flex-wrap items-center justify-between gap-2"> <h2>Cartesian chart</h2> <div className="flex gap-2"> <button type="button" aria-pressed={metric === "revenue"} className="rounded-md border border-border bg-card px-2.5 py-1 text-xs font-medium text-foreground" onClick={() => { setMetric("revenue"); }} > Monthly bar & line </button> <button type="button" aria-pressed={metric === "spark"} className="rounded-md border border-border bg-card px-2.5 py-1 text-xs font-medium text-foreground" onClick={() => { setMetric("spark"); }} > Sparkline focus </button> </div> </div> {metric === "revenue" ? ( <CartesianChart height={280} series={REVENUE_SERIES} title="Monthly revenue against target" xAxis={{ data: MONTHS, scaleType: "band" }} /> ) : ( <div className="rounded-lg border border-border bg-card p-4"> <SparkLineChart area curve="monotone" data={SPARK_VALUES} height={96} showHighlight showTooltip title="Weekly throughput" xAxisData={["W1", "W2", "W3", "W4", "W5", "W6", "W7", "W8"]} /> </div> )} </section> <section className="grid gap-6 md:grid-cols-2"> <div className="flex flex-col gap-2"> <h2>Pie chart</h2> <PieChart data={SHARE_SLICES} height={240} innerRadius={0.5} title="Component usage share" /> </div> <div className="flex flex-col gap-2"> <h2>Gauge</h2> <Gauge height={240} label="SLA attainment" value={84} valueMax={100} valueMin={0} /> </div> </section> </main> );};Props
CartesianChartProps
Prop
Type
ChartFrameProps
Prop
Type
ChartsRendererProps
Prop
Type
FunnelChartProps
Prop
Type
GaugeProps
Prop
Type
PieChartProps
Prop
Type
RadialBarChartProps
Prop
Type
RadialLineChartProps
Prop
Type
RadarChartProps
Prop
Type
SankeyChartProps
Prop
Type
SparkLineChartProps
Prop
Type
ChartWebGLLayerProps
Prop
Type
ZoomSliderProps
Prop
Type