Skip to content

Radial Chart

React radial bar chart of concentric progress rings with labels, a legend and a rolling center total that animate on data change, or one progress ring.

src/registry/ui/radial-chart.tsx/r/radial-chart.json

Installation

bash
npx shadcn@latest add @minidev/radial-chart

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/radial-chart.json

Usage

tsx
import { RadialChart } from "@/components/ui/radial-chart"

export function Example() {
  return (
    <RadialChart />
  )
}

API reference

RadialChart props
PropTypeDefault
dataRings, outermost first. One item renders a single radial progress ring.RadialDatum[]-
periodsDatasets to switch between with a segmented control. Ignored when `data` is set.RadialPeriod[]PERIODS
titlestring"Goals progress"
centerLabelLabel under the centre total.string-
centerValueOverride the centre value. Defaults to the average progress of all rings.React.ReactNode-
thicknessRing thickness in chart units (the chart is 240 wide).number-
gapGap between rings in chart units.number6
showLegendbooleantrue
classNamestring-

Keyboard interactions

Keyboard interactions
KeyAction
TabMoves focus to the period switch, when periods has more than one entry.
ArrowLeftorArrowRightIn the period switch, selects the previous or next period.

Accessibility

  • The SVG is role="img". Its aria-label is the title followed by each ring's label, percentage and "value of max".
  • The centre total is aria-hidden, because the name already holds every value.
  • Legend rows dim the other rings on pointer hover only; they are not focusable.
  • Under reduced motion the rings and centre number jump straight to new values instead of sweeping and rolling.

Frequently asked questions

How do I make a single radial progress ring?

Pass one item: <RadialChart title="Storage" data={[{ label: "Used", value: 38, max: 50 }]} />. It draws a full ring, shows the percentage in the centre with the item's label and "38 of 50" under it, and hides the legend.

How do I let people switch between periods?

Pass periods, an array of { label, data }, and leave out data. With more than one period a SegmentedControl appears in the header. data always wins over periods, so set only one of them.

What does the number in the middle mean?

With several rings it is the average progress across them, labelled "of goals". Override it with centerValue and centerLabel, for example a revenue total. Each ring's own value and max go through its format in the legend.

Dependencies

npm

motion

Examples

Single ring

One item turns the chart into a full radial progress ring with the value and its max written under the percentage.

Fixed data with a custom centre

Passing data removes the period switcher; centerValue and centerLabel replace the average when a count reads better.

Thin rings, no legend

thickness and gap shrink the rings and showLegend false leaves a compact widget for a dashboard tile.

Period switch

Pass periods instead of data and a segmented control above the rings swaps datasets; the rings sweep to the new values.

All chart components

Learn more