Components
Bullet chart
NativeCompare actual performance with targets and capacity.
Filled bar: actual · Vertical mark: target · Track: capacity
- New workspaces$184k of $200k target0$250k capacity
- Account expansion$128k of $110k target0$160k capacity
- Annual renewals$216k of $240k target0$300k capacity
| Metric | Actual | Target | Capacity |
|---|---|---|---|
| New workspaces | $184k | $200k | $250k |
| Account expansion | $128k | $110k | $160k |
| Annual renewals | $216k | $240k | $300k |
Installation
npx nook-ui@latest add bullet-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 "Bullet chart" component to this project, exactly as Nook ships it.
Compare actual performance with targets and capacity.
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 bullet-chart`. It writes `components/ui/bullet-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/bullet-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 { BulletChart } from "@/components/ui/bullet-chart";
export default function Example() {
return (
<BulletChart
title="Quarterly sales targets"
formatValue={(v) => `$${v}k`}
data={[
{ label: "New workspaces", value: 184, target: 200, max: 250 },
{ label: "Account expansion", value: 128, target: 110, max: 160 },
{ label: "Annual renewals", value: 216, target: 240, max: 300 },
]}
/>
);
}
```
API
- `BulletChart`: Compare actual performance with targets and capacity.
- `data` (`BulletDatum[]`): Label, actual value, target and maximum.
- `title` (`string`): Caption and data table name.
- `formatValue` (`(value: number) => string`): Value formatting.
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: Actual, target and capacity are written and included in the shared data table; the mark key is text.
Done when the component renders like the example in light and dark mode and the project type-checks.Usage
import { BulletChart } from "@/components/ui/bullet-chart";
export default function Example() {
return (
<BulletChart
title="Quarterly sales targets"
formatValue={(v) => `$${v}k`}
data={[
{ label: "New workspaces", value: 184, target: 200, max: 250 },
{ label: "Account expansion", value: 128, target: 110, max: 160 },
{ label: "Annual renewals", value: 216, target: 240, max: 300 },
]}
/>
);
}Props
BulletChart
Compare actual performance with targets and capacity.
| Prop | Type | Default | Description |
|---|---|---|---|
| data | BulletDatum[] | – | Label, actual value, target and maximum. |
| title | string | – | Caption and data table name. |
| formatValue | (value: number) => string | – | Value formatting. |
Accessibility
Actual, target and capacity are written and included in the shared data table; the mark key is text.
Checked against WCAG 2.1 AA with automated axe tests and keyboard tests on every release.