ProgressRing

ProgressRing

HkProgressRing is the circular progress arc: a stroked ring around an optional centre, sized in pixels, with a success / exception ink, an optional background track, a centred percentage and a slot for whatever the caller wants in the middle.

  • A ratio that reads as a length — a job with real steps, a file transfer, a storage split — is an HkProgressBar, where the eye judges the remaining track at a glance.
  • Work with no measurable fraction has no arc to draw: use an HkSpinner instead of a ring frozen at zero.

Import

tsx
1
import { HkProgressRing } from "@celestia-island/hikari";
rust
1
2
use hikari_components::*;          // ProgressRing, ProgressRingVariant, ProgressRingSegment
use hikari_components::prelude::*; // rsx!, VNode

Value, size and variant

value is a 0–100 percentage; pct overrides it when the caller already has a rounded figure. size is the outer diameter in pixels and strokeWidth the band's thickness — the geometry is computed from those two, so any pair draws a clean ring. variant recolours the arc: normal (the default), success or exception. showTrack draws the background circle; turn it off when the ring sits on its own dial.

The centre

showLabel prints the rounded percentage at a fifth of the ring's diameter. The default slot replaces it with your own content — a check glyph when the transfer finished, a count, a caption — which is the shape to reach for when the number alone does not say what the ring is measuring. In the Rust mirror that slot is the overlay element prop, and a present overlay suppresses the built-in label exactly like Vue.

72%
38/100

Segments

segments draws one arc per entry instead of a single fill: each value is a percentage of the whole ring, arcs are laid head to tail, and a one-percent gap is carved between neighbouring arcs so they never touch. Values are clamped to what remains up to 100%, and the arcs that collapse to nothing are skipped. value, pct and variant are ignored in this mode, and the accessible total becomes the sum of the segments. Colour rides an inline stroke, so rgb(var(--x) / a) resolves.

85%

Accessibility

  • The root is a progressbar: it publishes aria-valuenow (the percentage, or the segment sum), a minimum of 0 and a maximum of 100, so the ring needs no separate caption to be readable.
  • The arc is clipped from a full circle with a dash offset, which means the value survives zoom and print at any pixel size — nothing about the ring depends on colour alone to convey the number.
  • In segments mode the total is rounded to one decimal and clamped to 100; the arcs themselves are not announced individually.
  • The ring is not interactive; it takes no focus and no keyboard input.

API

Vue

Props

NameTypeDefaultRequired
valueNumber0—
pctNumberundefined—
sizeNumber120—
strokeWidthNumber8—
variant<code>String as PropType<"normal" | "success" | "exception"></code>"normal"—
showLabelBooleanfalse—
showTrackBooleantrue—
segmentsArray as PropType<HProgressRingSegment[]>undefined—

Rust

Props — ProgressRing

PropTypeDefaultDescription
valuef640.0Ring value 0-100 (Vue default 0).
pctOption<f64>NoneExplicit percentage override (Vue: pct wins over value).
sizef64120.0Outer ring diameter in px (default 120).
stroke_widthf648.0Stroke width in px (default 8).
variantProgressRingVariantProgressRingVariant::NormalFill ink flavor.
show_labelboolfalseRender the centered percentage label (suppressed when overlay is present, like Vue's default-slot check).
show_trackbooltrueRender the background track circle (false for overlay-only use).
segmentsOption<Vec<ProgressRingSegment>>NoneSegmented mode: when Some (an empty vec included) each segment is its own arc; value/pct/variant are ignored.
overlayOption<Element>NoneCentered overlay content (Vue: the default slot).

Related components

  • HkProgressBar — the same ratio as a track, with segments and a caption line.
  • HkSpinner — an indefinite busy indicator where a ring would read as a stalled one.
  • HkSkeleton — the placeholder shape of whatever the ring is measuring.
  • HkEmptyState — the panel to show when the wait ends with nothing.
  • HkIconButton — an icon-only trigger, when the ring is meant to sit inside a button.