Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

A radial chart for Ark UI

One ring per browser. The arc follows the visitor count, over a muted track, and the tooltip names the browser and the count.

One ring per browser. The arc length follows the visitor count, over a muted track. The tooltip names the browser and the count.

Use radial bars to compare a few categories as rings. A normal bar chart is easier once the names get long. A Table is easier for the counts. In React, Ark UI maps each ring's color to a variable. You pass the visitor counts.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.
Use email insteadNo credit card

Anatomy

Chart anatomy: container, grid, axis, bar, tooltip, legend

Usage

<div className="w-full max-w-xl rounded-md border bg-background p-4">
  <ChartContainer
    className="mx-auto aspect-square max-h-[250px]"
    config={chartConfig}
  >
    <RadialBarChart data={chartData} innerRadius={30} outerRadius={110}>
      <ChartTooltip content={renderTooltipContent} cursor={false} />
      <RadialBar background dataKey="visitors" />
    </RadialBarChart>
  </ChartContainer>
</div>

FAQ

How do I set the hole and the outer edge?

RadialBarChart sets innerRadius={30} and outerRadius={110}. The five browser rows share that band. Each row's visitors value is how far that arc runs. Chrome is 275 and Other is 90.

What does background draw?

RadialBar sets background and dataKey="visitors". background draws the full-circle track behind each arc, and the chart styles that sector with the muted fill. The colored part is the visitors value.

How does the tooltip name a ring?

ChartTooltipContent sets hideLabel and nameKey="browser". hideLabel drops the title. nameKey reads the row's browser field and looks it up in config, so the row says Chrome, Safari, Firefox, Edge, or Other. cursor={false} turns the hover cursor off.

Where does each ring's color come from?

Each chartData row sets fill to var(--color-chrome) or the matching key. config maps those keys to var(--chart-1) through var(--chart-5), and ChartContainer writes the --color- variables. visitors in config is only the label Visitors.

How do I add another browser?

Add a row to chartData with browser, visitors, and fill, and add a matching entry in config with a label and a color. RadialBar already maps dataKey="visitors" across the whole array. This file doesn't set startAngle or endAngle, so the track is a full circle.

How do I keep it square?

ChartContainer sets mx-auto aspect-square max-h-[250px] inside a w-full max-w-xl frame. That overrides the container's default 16:9 box.

API Reference

Chart

Sets config={chartConfig}, content={renderTooltipContent} and cursor={false}. The rest is on the Chart page.