Throughput gauge
Half-circle pixel gauge for tokens per second with amber and red zones, a spring needle that overshoots and a peak marker.
Demo data
The tokens-per-second reading is simulated; only max can be set. It cannot show your own data yet, so use it as a template: replace the invented data in its source before it shows anything real. See Your data.
Playground
Change a prop and the component updates. Props marked live animate to the new value; the others rebuild the element.
<PxGauge max={200} />Installation
pnpm dlx shadcn@latest add @lumesec/px-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/px-gauge.jsonUsage
import { PxGauge } from "@/components/lumesec/px-gauge";
export function Example() {
return (
<PxGauge />
);
}Behaviour
Tokens per second on four rings of pixels, with amber and red zones. The needle is a spring, so it overshoots and settles, and a peak marker hangs at the high point before sliding back.
API reference
Attributes
maxReact propmaxTypenumberDefault200Full-scale value of the gauge and its tick labels; a missing, invalid or non-positive value uses 200. Read every frame, so a change applies immediately.
Properties
maxTypenumberFull-scale value; reflects the max attribute, 200 when it is missing, invalid or not positive.
Keyboard
| Keys | Action |
|---|---|
| Space / Enter (on the boost button) | Boost while held; releasing the key or moving focus away ends the boost. |
Accessibility
- The dial (canvas and reading) has
role="meter",aria-label="Output speed in tokens per second"andaria-valuemin="0". aria-valuenow,aria-valuemaxandaria-valuetext("72 tokens per second") are updated about twice per second; the visible reading is text inside the meter.- The "Hold to boost" button is a native button with
aria-pressedreflecting the boost state. - Reduced motion: the needle tracks the value directly without spring overshoot and the red zone stops flickering.
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 --destructive, --foreground, --lumesec and --muted-foreground.
To restyle only LumeSec elements, set the matching --ui-* overrides: --ui-accent, --ui-danger, --ui-fg, --ui-mono and --ui-muted.
Notes
- The reading is simulated demo data: it idles around 36% of
maxwith noise and climbs to about 93% while boosted. There is no attribute for feeding a real value. - Pressing and holding the button or the gauge itself boosts it; the amber zone starts at 70% of
maxand the red zone at 86%. - The reading is set in the monospace font, scales with the dial and turns red in the red zone.
- The canvas is 180px tall.
Related
Was this page helpful?