Charts

Charts from shadcn/ui and other libraries, themed by the design system.

Charts come from more than one library. Each page is a chart type, and every chart credits the library it comes from and installs from there. Series colors map to the neutral --chart-1 … --chart-5 ramp, so charts match the rest of the interface in both themes.

shadcn/ui charts

Built with Recharts and the shadcn chart component, which maps each series to a CSS variable. Install the component, then copy any chart's code from its Code tab.

npx shadcn@latest add chart card
const chartConfig = {
  desktop: { label: "Desktop", color: "var(--chart-1)" },
  mobile: { label: "Mobile", color: "var(--chart-2)" },
} satisfies ChartConfig

<ChartContainer config={chartConfig} className="min-h-[200px] w-full">
  <BarChart accessibilityLayer data={chartData}>
    <CartesianGrid vertical={false} />
    <XAxis dataKey="month" tickLine={false} axisLine={false} />
    <ChartTooltip content={<ChartTooltipContent />} />
    <Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
    <Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
  </BarChart>
</ChartContainer>

ChartContainer turns each config key into a --color-<key> variable, which the series reference. Change a series color in the config, not in the chart.

Bklit UI charts

Bklit UI charts are built on visx and Motion, composed from parts (<AreaChart>, <Area>, <Grid>, <XAxis>, <ChartTooltip>) and installed from the @bklit registry. Their colors come from the --chart-* tokens in global.css.

npx shadcn@latest add @bklit/area-chart

Guidelines

  • Do start every series at --chart-1 and step down the ramp.
  • Do reserve status colors (--success, --destructive) for values that mean good or bad.
  • Do hide the vertical grid and axis lines; let the data carry the chart.
  • Do keep accessibilityLayer on Recharts charts for keyboard and screen-reader access.
  • Don't use more than five series in one chart.

All charts