Gauge

A circular gauge for a value within a range.

  • Native host
  • New in 0.1
import { Gauge, gaugePrimitive } from "nitro-ui-sdk/gauge";
HeroUI Native
ProgressCircle (Pro)
Expo UI
Gauge
  • Gauge example screen, light appearance
    Light
  • Gauge example screen, dark appearance
    Dark
On this page

Gauge draws a circular value, such as storage used or a score. The ring is native: a track and a progress arc with rounded caps. The number and the caption in the center are composed and hidden from assistive tech, so the ring speaks once.

Use Progress for a bar or a spinner. Gauge has no indeterminate state.

Anatomy

<Gauge.Root label="Storage" value={64} size="lg">
  <Gauge.Value />
  <Gauge.Label />
</Gauge.Root>
Part Description
Root Sizes the ring and registers the agent entry.
Label Center caption. Hidden on the small size unless you place it yourself.
Value Center text, such as 64%.

Usage

import { Gauge } from "nitro-ui-sdk/gauge";

export function Storage() {
  return <Gauge.Root label="Storage" value={64} />;
}

Variants and sizes

size is sm (48), md (84), or lg (120). md is the default. Stroke is 4, 7, and 10 points. intent colors the arc: accent (default), success, warning, or danger.

<Gauge.Root label="Done" value={100} size="md" intent="success" />

The small ring shows the value only in the default layout, because a caption does not fit. Pass Gauge.Label as a child when you want it.

States

The value is clamped to min…max. The first prop batch snaps to that value, including a value that is not zero. Later changes animate over 0.35s unless animating is false or the theme asks for reduced motion. A label or color update that keeps the same value does not cancel the running animation. Reduced motion cancels it and snaps.

Controlled

The parent owns value. Gauge does not keep a number of its own.

const [value, setValue] = useState(64);

<Gauge.Root label="Storage" value={value} min={0} max={100} />

min defaults to 0 and max defaults to 100.

Liquid Glass

Gauge does not draw Liquid Glass. The track uses the opaque default color and the arc uses the intent color.

Props

Root

Prop Type Default Description
label string — Accessible name and the default caption. Required.
value number 0 Current value.
min number 0 Lower bound.
max number 100 Upper bound.
intent "accent" | "success" | "warning" | "danger" "accent" Arc color.
size "sm" | "md" | "lg" "md" Diameter.
valueText string "{percent} percent" Spoken value, for example 64 percent.
formatValue (state: GaugeState) => string — Custom spoken value.
animating boolean true Animates changes. Ignored when motion is reduced.
styles GaugeStyles — Per-part style resolvers.
api Controller<GaugeActions> — Attached controller.
agentId string — Stable agent id.
layout layout — Extra layout merged onto the root.

Label and Value

Each accepts children to replace the string. Both are inside a hidden accessibility container.

Controller API

import { gaugePrimitive } from "nitro-ui-sdk/gauge";

const api = gaugePrimitive.createApi();
api.current?.getState();
Action Signature Result
getState () => GaugeState Clamped value, bounds, ratio, rounded percent, and intent.

Styles

The resolver receives tokens, variant (the intent), size, and state. The ring reads its track from background and its arc from borderColor.

<Gauge.Root
  label="Storage"
  value={64}
  styles={{
    ring: ({ tokens }) => ({
      style: { background: tokens.colors.default, borderColor: tokens.colors.accent },
    }),
    value: ({ tokens }) => ({ text: { color: tokens.colors.foreground } }),
  }}
/>

Accessibility

The native ring is the accessibility element. Its name is label. Its value is the spoken string, 64 percent by default. The center text is accessibilityHidden. The agent value is the percent number, and the agent text is the spoken string.

Agent API

Read-only. Role progressbar. The value is the percent. The text is the spoken string. State is { busy: false }. There are no actions.

Platform notes

iOS Android
Drawing CAShapeLayer track and arc on KitGaugeView, rounded caps, starting at the top. Canvas arcs with rounded stroke caps.
Motion 0.35s ease on later value changes. The first value snaps. ValueAnimator for 350ms, with the same snap rules. A ring that detaches snaps to its target so it shows the full value on reattachment.
Verification Built and exercised by the iOS harness on the lanes simulator. Kotlin is written to compile and was not built on this machine. There is no Android NDK here.