LatestArea Charts

Radial Charts

Radial bars and progress rings, with a label in the centre.

Radial Chart

Default

Radial bars and progress rings, with a label in the centre.

Radial Chart

Stacked with centre total

Radial Chart

Progress ring

Radial Chart

Labels

Radial Chart

Grid

Radial Chart
Fundraiser
Q3 goal · $50,000
$14,000 to go · 18 days left
Radial Chart

Gauge shape

Radial Chart

Multiple rings with legend

Installation

pnpm dlx shadcn@latest add https://kagadmodyaa.vercel.app/r/chart.json

Needs a React + Tailwind project set up with shadcn. Copies the component source straight into your project, so you can edit it.

Chart imports cn() from lib/utils.ts — add it too if you don't have it yet:

import { clsx, type ClassValue } from 'clsx'
import { twMerge } from 'tailwind-merge'

export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs))
}

Every chart shares one foundation, the chart component — installing it also adds recharts. The examples on this page are what you copy into your own components.

A few interactive examples are built with other components from this site — card, toggle-group, tabs and select. Add the ones an example imports; the chart itself needs none of them.

Series are painted from a five-colour palette. The CLI adds these variables for you; on a manual install, add them to your global CSS:

:root {
  --chart-1: oklch(0.63 0.23 36);
  --chart-2: oklch(0.55 0.2 252);
  --chart-3: oklch(0.58 0.16 145);
  --chart-4: oklch(0.78 0.18 75);
  --chart-5: oklch(0.52 0.015 260);
}

.dark {
  --chart-1: oklch(0.72 0.19 36);
  --chart-2: oklch(0.66 0.19 252);
  --chart-3: oklch(0.68 0.17 145);
  --chart-4: oklch(0.85 0.17 75);
  --chart-5: oklch(0.72 0.012 260);
}

@theme inline {
  --color-chart-1: var(--chart-1);
  --color-chart-2: var(--chart-2);
  --color-chart-3: var(--chart-3);
  --color-chart-4: var(--chart-4);
  --color-chart-5: var(--chart-5);
}

Usage

import { RadialBar, RadialBarChart } from 'recharts'
import { ChartContainer, ChartTooltip, ChartTooltipContent, type ChartConfig } from '@/components/ui/chart'

// Like a pie, radial bars take one config entry per bar, and each row carries its own fill.
const data = [
  { browser: 'chrome', visitors: 1240, fill: 'var(--color-chrome)' },
  { browser: 'safari', visitors: 860, fill: 'var(--color-safari)' },
]

const config = {
  chrome: { label: 'Chrome' },
  safari: { label: 'Safari' },
} satisfies ChartConfig

<ChartContainer config={config} className="mx-auto aspect-square w-full max-w-[280px]">
  <RadialBarChart data={data} innerRadius="28%" outerRadius="100%" barSize={16}>
    <ChartTooltip cursor={false} content={<ChartTooltipContent hideLabel nameKey="browser" />} />
    <RadialBar dataKey="visitors" background cornerRadius={8} />
  </RadialBarChart>
</ChartContainer>

API Reference

NameTypeDefaultDescription
ChartContainer configRecord<string, { label: string; color?: string }>—Required. One entry per series (or pie slice). Each key becomes the CSS variable --color-<key>; colour defaults to --chart-1, --chart-2, … in order.
ChartContainer childrenReactElement—Required. One Recharts chart (AreaChart, BarChart, …). It is wrapped in a ResponsiveContainer for you.
ChartContainer classNamestringaspect-video min-h-[200px] w-fullSizes the chart. Override the aspect ratio or height here — e.g. mx-auto aspect-square w-full max-w-[280px] for polar charts.
ChartTooltipContent indicator'dot' | 'line' | 'dashed''dot'How each row’s colour marker is drawn.
ChartTooltipContent hideLabelbooleanfalseHide the heading (the x-axis value).
ChartTooltipContent hideIndicatorbooleanfalseHide the colour markers.
ChartTooltipContent nameKeystring—Field of the data row that holds the name to look up in config — used by pie and radial charts.
ChartTooltipContent labelKeystring—Field of the data row to use as the heading instead of the axis value.
ChartTooltipContent labelFormatter(label, payload) => ReactNode—Format the heading.
ChartTooltipContent formatter(value, name, item) => ReactNode—Replace how a row’s value is rendered (numbers use thousands separators by default).
ChartLegendContent hideIconbooleanfalseHide the colour swatches.
ChartLegendContent nameKeystring—Field of the data row that holds the name to look up in config — used by pie charts.