Components
Radial Chart
NativeProgress toward a goal for several measures at once, drawn as nested rings.
Closed2 of 3
| Measure | Value | Goal |
|---|---|---|
| Move | 520 | 600 |
| Exercise | 24 | 30 |
| Stand | 9 | 12 |
Installation
npx nook-ui@latest add radial-chartPrompt
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.
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
| Measure | Value | Goal |
|---|---|---|
| Revenue | 82% | 100% |
| New customers | 64% | 100% |
| Retention | 91% | 100% |
| Support score | 47% | 100% |
One ring
68%complete
| Measure | Value | Goal |
|---|---|---|
| Progress | 68 | 100 |
Props
RadialChart
The chart. Content passed as children sits in the middle.
| Prop | Type | Default | Description |
|---|---|---|---|
| data | { label; value; max? }[] | – | Up to five measures, outermost first. |
| max | number | 100 | The full ring for measures without their own max. |
| thickness | number | 3 | Ring thickness on a 40 unit drawing. |
| title | string | – | 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.