Gauge
Semicircular gauge of green, amber and red cells with a sprung pointer; the zone word rolls when the value crosses a threshold.
Playground
Change a prop and the component updates. Props marked live animate to the new value; the others rebuild the element.
<HfGauge
value={72}
min={0}
max={100}
zones="60,85"
decimals={0}
label="Rate limit"
unit="%"
/>Installation
pnpm dlx shadcn@latest add @lumesec/hf-gaugeFirst 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}.jsonOr skip the setup and install by URL:
npx shadcn@latest add https://elements.lumesec.ai/r/hf-gauge.jsonUsage
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 propvalueTypenumberDefault42Current value, clamped to min–max. Observed.
minReact propminTypenumberDefault0Lower bound. Not observed; read when value changes.
maxReact propmaxTypenumberDefault100Upper bound. Not observed; read when value changes.
zonesReact propzonesTypestringDefault60,85Two thresholds in value units, comma-separated: Elevated from the first, Critical from the second.
decimalsReact propdecimalsTypenumberDefault0Decimal places in the displayed number.
labelReact proplabelTypestringDefaultRate limitText under the gauge and the start of the aria-label.
unitReact propunitTypestringDefault%Text after the number. An empty value hides it.
Properties
valueTypenumberClamped value. Setting it writes the attribute.
min (read-only)TypenumberParsed min.
max (read-only)TypenumberParsed max.
frac (read-only)TypenumberPosition 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"witharia-valuemin,aria-valuemax,aria-valuenowand anaria-labelsuch asRate 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
- The visible
labelandunittext is set once on connect; thearia-labelre-reads both on eachvaluechange.
Related
Was this page helpful?