Components
Gauge
NativeA bounded measurement with named ranges and a square position marker.
Workspace storage68 GB
0 GBPlan ahead100 GB
- Comfortable · 0 GB–60 GB
- Plan ahead · 60 GB–85 GB
- Near capacity · 85 GB–100 GB
| Range | From | To |
|---|---|---|
| Comfortable | 0 GB | 60 GB |
| Plan ahead | 60 GB | 85 GB |
| Near capacity | 85 GB | 100 GB |
Installation
npx nook-ui@latest add gaugePrompt
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 "Gauge" component to this project, exactly as Nook ships it.
A bounded measurement with named ranges and a square position marker.
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 gauge`. It writes `components/ui/gauge.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/gauge.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 { Gauge } from "@/components/ui/gauge";
export default function Example() {
return (
<Gauge
className="w-full max-w-md"
title="Workspace storage"
value={68}
min={0}
max={100}
low={60}
high={85}
optimum={20}
formatValue={(v) => `${v} GB`}
ranges={[
{ label: "Comfortable", to: 60 },
{ label: "Plan ahead", to: 85 },
{ label: "Near capacity", to: 100 },
]}
/>
);
}
```
API
- `Gauge`: A bounded measurement with named ranges and a square position marker.
- `value / min / max` (`number`): Current measurement and bounds.
- `ranges` (`GaugeRange[]`): Named upper thresholds.
- `low / high / optimum` (`number`): Native meter semantics.
- `title` (`string`): Visible label and meter 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: A native meter exposes min, max, current value and optional low/high/optimum; ranges are written and tabulated.
Done when the component renders like the example in light and dark mode and the project type-checks.Usage
import { Gauge } from "@/components/ui/gauge";
export default function Example() {
return (
<Gauge
className="w-full max-w-md"
title="Workspace storage"
value={68}
min={0}
max={100}
low={60}
high={85}
optimum={20}
formatValue={(v) => `${v} GB`}
ranges={[
{ label: "Comfortable", to: 60 },
{ label: "Plan ahead", to: 85 },
{ label: "Near capacity", to: 100 },
]}
/>
);
}Props
Gauge
A bounded measurement with named ranges and a square position marker.
| Prop | Type | Default | Description |
|---|---|---|---|
| value / min / max | number | – | Current measurement and bounds. |
| ranges | GaugeRange[] | – | Named upper thresholds. |
| low / high / optimum | number | – | Native meter semantics. |
| title | string | – | Visible label and meter name. |
| formatValue | (value: number) => string | – | Value formatting. |
Accessibility
A native meter exposes min, max, current value and optional low/high/optimum; ranges are written and tabulated.
Checked against WCAG 2.1 AA with automated axe tests and keyboard tests on every release.