Skip to content
Haze UI

Gauge

Read one clamped measurement against a known range, with named threshold bands and an optional native adjustment control.

pnpm dlx shadcn@latest add @haze/gauge
Open preview in a new tab
Livesmall script

When to use

  • Capacity or health has a meaningful minimum and maximum.
  • A named threshold explains when a reading needs attention.

When not to use

  • Several independent measurements need comparison. Use bar-chart.

Installation

Add the Haze registry to components.json once, then install Gauge with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/gauge
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
labelstringStorage capacityVisible caption and accessible name of the native meter.
valuenumber64Finite reading, clamped to the valid range; nonfinite values use the minimum.
minnumber0Lower bound. A nonfinite bound becomes zero.
maxnumber100Upper bound; invalid ranges receive a positive fallback span.
unitstring%Suffix for the visible value and accessible reading.
bands{ max: number; label: string; tone?: string }[]–Upper thresholds sorted ascending; semantic tones are brand, success, warning and destructive.
adjustablebooleanfalseShow a native range control after enhancement.
classstring–Additional classes on the chart figure.

Keyboard interactions

Arrow keysHomeEnd
Adjust the value when the optional range is enabled.

Accessibility

  • The native meter exposes its bounds, value and threshold label; the visual ring duplicates that information.
  • The optional range changes the value and threshold text together, with ring travel removed by reduced motion.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Gauge" with `npx shadcn@latest add @haze/gauge`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import Gauge from "@/components/haze/ui/gauge.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/gauge.md

  • Customize with real content

    Adapt the Haze gauge ui for our product. Replace the demo values of these props with our real content: label, value, min, max, unit, bands, adjustable, class. Keep the layout, the heading level rules and these accessibility details: The native meter exposes its bounds, value and threshold label; the visual ring duplicates that information. The optional range changes the value and threshold text together, with ring travel removed by reduced motion. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using gauge, check it fits: use it when capacity or health has a meaningful minimum and maximum.; a named threshold explains when a reading needs attention.. Avoid it when several independent measurements need comparison. use bar-chart.. Alternatives: @haze/progress, @haze/bar-chart.

Dependencies

  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog