nook
Browse the docs

Components

Radial Chart

Native

Progress toward a goal for several measures at once, drawn as nested rings.

See the prompt
Today's activity rings
Closed2 of 3
Today's activity rings
MeasureValueGoal
Move520600
Exercise2430
Stand912

Installation

npx nook-ui@latest add radial-chart

Prompt

Paste this into your AI coding assistant. It adds this exact component, the same way the CLI does, and tells the assistant how to use it.

Short. For assistants that can run commands in your project.

Plain text
Add the Nook "Radial Chart" component to this project, exactly as Nook ships it.

Progress toward a goal for several measures at once, drawn as nested rings.

Steps
1. Check for `nook.json` in the project root. If it is missing, run `npx nook-ui@latest init` first (React or Next.js with Tailwind CSS v4). It adds the Nook tokens, the theme and `cn()`.
2. Run `npx nook-ui@latest add radial-chart`. It writes `components/ui/radial-chart.tsx` together with everything the component needs. Do not write the component from memory.
3. If you cannot run commands, fetch http://localhost:3000/r/radial-chart.json, write every entry of `files` to the path it names, install the packages in `dependencies`, and repeat for each name in `registryDependencies`.
4. Use it where I ask. Start from this example:

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

const DATA = [
  { label: "Move", value: 520, max: 600 },
  { label: "Exercise", value: 24, max: 30 },
  { label: "Stand", value: 9, max: 12 },
];

export default function RadialChartDefault() {
  return (
    <RadialChart className="w-full" title="Today's activity rings" data={DATA}>
      <span className="text-xs text-muted-foreground">Closed</span>
      <span className="text-xl font-semibold tabular-nums">2 of 3</span>
    </RadialChart>
  );
}
```

API
- `RadialChart`: The chart. Content passed as children sits in the middle.
  - `data` (`{ label; value; max? }[]`): Up to five measures, outermost first.
  - `max` (`number`, default 100): The full ring for measures without their own max.
  - `thickness` (`number`, default 3): Ring thickness on a 40 unit drawing.
  - `title` (`string`): What the chart shows.
  - `formatValue` (`(value: number) => string`): Formats values.

Rules
- Colors, radii, shadows and motion come from Nook tokens and classes such as `bg-primary`, `text-muted-foreground`, `border-border`, `rounded-lg` and `h-control`. Never hard-code them.
- Do not restyle or simplify the file. Change how it looks through `className`, its props and the theme.
- It must keep working with the keyboard, in light and dark mode, and in the sharp, soft and bold styles.
- Accessibility: The same data is in a table for screen readers, with each measure's value and goal. Every ring has a title and the list names each measure with its value.

Done when the component renders like the example in light and dark mode and the project type-checks.

Usage

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

const DATA = [
  { label: "Move", value: 520, max: 600 },
  { label: "Exercise", value: 24, max: 30 },
  { label: "Stand", value: 9, max: 12 },
];

export default function RadialChartDefault() {
  return (
    <RadialChart className="w-full" title="Today's activity rings" data={DATA}>
      <span className="text-xs text-muted-foreground">Closed</span>
      <span className="text-xl font-semibold tabular-nums">2 of 3</span>
    </RadialChart>
  );
}

Examples

Goals reached

Quarter goals reached, in percent
Quarter goals reached, in percent
MeasureValueGoal
Revenue82%100%
New customers64%100%
Retention91%100%
Support score47%100%

One ring

Course progress: 68 percent
68%complete
Course progress: 68 percent
MeasureValueGoal
Progress68100

Props

RadialChart

The chart. Content passed as children sits in the middle.

PropTypeDefaultDescription
data{ label; value; max? }[]–Up to five measures, outermost first.
maxnumber100The full ring for measures without their own max.
thicknessnumber3Ring thickness on a 40 unit drawing.
titlestring–What the chart shows.
formatValue(value: number) => string–Formats values.

Accessibility

The same data is in a table for screen readers, with each measure's value and goal. Every ring has a title and the list names each measure with its value.

Checked against WCAG 2.1 AA with automated axe tests and keyboard tests on every release.