Skip to content
NewYour data: charts, lists and meters that take your records
<hf-gauge>Custom elementFeedback

Gauge

Semicircular gauge of green, amber and red cells with a sprung pointer; the zone word rolls when the value crosses a threshold.

View as Markdown
<hf-gauge>

Your data

Set value (with min, max and zones). Without it the gauge shows a demo value. See Your data.

Playground

Change a prop and the component updates. Props marked live animate to the new value; the others rebuild the element.

Loading <hf-gauge>
Props
valuelive
minlive
maxlive
zoneslive
decimalslive
labellive
unitlive
<HfGauge
  value={72}
  min={0}
  max={100}
  zones="60,85"
  decimals={0}
  label="Rate limit"
  unit="%"
/>

Installation

pnpm dlx shadcn@latest add @lumesec/hf-gauge
First timeRegister the @lumesec registry once, or install by URL

Adds @lumesec to your components.json:

pnpm dlx shadcn@latest registry add @lumesec=https://elements.lumesec.ai/r/{name}.json

Or skip the setup and install by URL:

npx shadcn@latest add https://elements.lumesec.ai/r/hf-gauge.json

Usage

import { HfGauge } from "@/components/lumesec/hf-gauge";

export function Example() {
  return (
    <HfGauge value={72} label="Rate limit" zones="60,85" />
  );
}

Behaviour

A semicircle of green, amber and red cells with a sprung pointer and a shimmer in the filled part. Past the last zone it pulses. The status word rolls when the zone changes.

API reference

Attributes

valueReact propvalueTypenumberDefault42

Current value, clamped to min–max. Observed.

minReact propminTypenumberDefault0

Lower bound. Observed.

maxReact propmaxTypenumberDefault100

Upper bound. Observed.

zonesReact propzonesTypestringDefault60,85

Two thresholds in value units, comma-separated: Elevated from the first, Critical from the second. A missing or invalid threshold uses 60 or 85. Observed.

decimalsReact propdecimalsTypenumberDefault0

Decimal places in the displayed number. Observed.

labelReact proplabelTypestringDefaultRate limit

Text under the gauge and the start of the aria-label. Observed.

unitReact propunitTypestringDefault%

Text after the number. An empty value hides it. Observed.

Properties

valueTypenumber

Clamped value. Setting it writes the attribute.

min (read-only)Typenumber

Parsed min.

max (read-only)Typenumber

Parsed max.

frac (read-only)Typenumber

Position of the value in the range, 0 to 1.

zones (read-only)Type[number, number]

The two thresholds as fractions of the range, 0 to 1.

Accessibility

  • The canvas has role="meter" with aria-valuemin, aria-valuemax, aria-valuenow and an aria-label such as Rate limit: 72%, Elevated.
  • The number and zone word are plain text; there is no live region.
  • Reduced motion: the pointer jumps without the spring, the shimmer and the critical pulse are off, and the number and zone word swap without rolling.

Theming

The element reads your shadcn theme tokens through its shadow root, so light and dark follow your theme. The accent comes from --lumesec. See Theming.

This component reads --foreground, --lumesec, --lumesec-success and --muted-foreground.

To restyle only LumeSec elements, set the matching --ui-* overrides: --ui-accent, --ui-fg, --ui-muted and --ui-ok.

Notes

  • All attributes are observed; a change animates the pointer to the new position.

Was this page helpful?