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
import { HkProgressRing } from "@celestia-island/hikari";
use hikari_components::*; use hikari_components::prelude::*;
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.
import { HkProgressRing } from "@celestia-island/hikari";
import type { CSSProperties } from "vue";
const row: CSSProperties = { display: "flex", gap: "24px", alignItems: "center" };
export default () => (
<div style={row}>
<HkProgressRing value={25} />
<HkProgressRing value={60} variant="success" />
<HkProgressRing value={80} variant="exception" size={80} strokeWidth={6} />
<HkProgressRing value={45} showTrack={false} size={64} strokeWidth={10} />
</div>
);
rsx! {
div { style: "display:flex;gap:24px;align-items:center",
ProgressRing { value: 25.0 }
ProgressRing { value: 60.0, variant: ProgressRingVariant::Success }
ProgressRing { value: 80.0, variant: ProgressRingVariant::Exception, size: 80.0, stroke_width: 6.0 }
ProgressRing { value: 45.0, show_track: false, size: 64.0, stroke_width: 10.0 }
}
}
import { HkProgressRing } from "@celestia-island/hikari";
import type { CSSProperties } from "vue";
const row: CSSProperties = { display: "flex", gap: "24px", alignItems: "center" };
export default () => (
<div style={row}>
<HkProgressRing value={25} />
<HkProgressRing value={60} variant="success" />
<HkProgressRing value={80} variant="exception" size={80} strokeWidth={6} />
<HkProgressRing value={45} showTrack={false} size={64} strokeWidth={10} />
</div>
);rsx! {
div { style: "display:flex;gap:24px;align-items:center",
ProgressRing { value: 25.0 }
ProgressRing { value: 60.0, variant: ProgressRingVariant::Success }
ProgressRing { value: 80.0, variant: ProgressRingVariant::Exception, size: 80.0, stroke_width: 6.0 }
ProgressRing { value: 45.0, show_track: false, size: 64.0, stroke_width: 10.0 }
}
}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.
import { HkProgressRing, HkIcon } from "@celestia-island/hikari";
import type { CSSProperties } from "vue";
const row: CSSProperties = { display: "flex", gap: "24px", alignItems: "center" };
export default () => (
<div style={row}>
<HkProgressRing value={72} showLabel />
<HkProgressRing value={100} variant="success">
<HkIcon name="Check" size={24} />
</HkProgressRing>
<HkProgressRing value={38} size={96} strokeWidth={10}>
<span>38/100</span>
</HkProgressRing>
</div>
);
rsx! {
div { style: "display:flex;gap:24px;align-items:center",
ProgressRing { value: 72.0, show_label: true }
ProgressRing {
value: 100.0,
variant: ProgressRingVariant::Success,
overlay: Some(rsx! { Icon { icon: MdiIcon::Check, size: 24 } }),
}
ProgressRing { value: 38.0, size: 96.0, stroke_width: 10.0, overlay: Some(rsx! { span { "38/100" } }) }
}
}
import { HkProgressRing, HkIcon } from "@celestia-island/hikari";
import type { CSSProperties } from "vue";
const row: CSSProperties = { display: "flex", gap: "24px", alignItems: "center" };
export default () => (
<div style={row}>
<HkProgressRing value={72} showLabel />
<HkProgressRing value={100} variant="success">
<HkIcon name="Check" size={24} />
</HkProgressRing>
<HkProgressRing value={38} size={96} strokeWidth={10}>
<span>38/100</span>
</HkProgressRing>
</div>
);rsx! {
div { style: "display:flex;gap:24px;align-items:center",
ProgressRing { value: 72.0, show_label: true }
ProgressRing {
value: 100.0,
variant: ProgressRingVariant::Success,
overlay: Some(rsx! { Icon { icon: MdiIcon::Check, size: 24 } }),
}
ProgressRing { value: 38.0, size: 96.0, stroke_width: 10.0, overlay: Some(rsx! { span { "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.
import { HkProgressRing } from "@celestia-island/hikari";
import type { CSSProperties } from "vue";
const parts = [
{ value: 45 },
{ value: 25, color: "rgb(34 197 94)" },
{ value: 15, color: "rgb(59 130 246)" },
];
const row: CSSProperties = { display: "flex", gap: "24px", alignItems: "center" };
export default () => (
<div style={row}>
<HkProgressRing segments={parts} showLabel size={120} />
<HkProgressRing segments={parts} showTrack={false} size={72} strokeWidth={8} />
</div>
);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
rsx! {
div { style: "display:flex;gap:24px;align-items:center",
ProgressRing {
show_label: true,
size: 120.0,
segments: Some(vec![
ProgressRingSegment { value: 45.0, ..Default::default() },
ProgressRingSegment {
value: 25.0,
color: Some("rgb(34 197 94)".to_string()),
..Default::default()
},
ProgressRingSegment {
value: 15.0,
color: Some("rgb(59 130 246)".to_string()),
..Default::default()
},
]),
}
ProgressRing {
show_track: false,
size: 72.0,
stroke_width: 8.0,
segments: Some(vec![
ProgressRingSegment { value: 45.0, ..Default::default() },
ProgressRingSegment {
value: 25.0,
color: Some("rgb(34 197 94)".to_string()),
..Default::default()
},
ProgressRingSegment {
value: 15.0,
color: Some("rgb(59 130 246)".to_string()),
..Default::default()
},
]),
}
}
}
import { HkProgressRing } from "@celestia-island/hikari";
import type { CSSProperties } from "vue";
const parts = [
{ value: 45 },
{ value: 25, color: "rgb(34 197 94)" },
{ value: 15, color: "rgb(59 130 246)" },
];
const row: CSSProperties = { display: "flex", gap: "24px", alignItems: "center" };
export default () => (
<div style={row}>
<HkProgressRing segments={parts} showLabel size={120} />
<HkProgressRing segments={parts} showTrack={false} size={72} strokeWidth={8} />
</div>
);rsx! {
div { style: "display:flex;gap:24px;align-items:center",
ProgressRing {
show_label: true,
size: 120.0,
segments: Some(vec![
ProgressRingSegment { value: 45.0, ..Default::default() },
ProgressRingSegment {
value: 25.0,
color: Some("rgb(34 197 94)".to_string()),
..Default::default()
},
ProgressRingSegment {
value: 15.0,
color: Some("rgb(59 130 246)".to_string()),
..Default::default()
},
]),
}
ProgressRing {
show_track: false,
size: 72.0,
stroke_width: 8.0,
segments: Some(vec![
ProgressRingSegment { value: 45.0, ..Default::default() },
ProgressRingSegment {
value: 25.0,
color: Some("rgb(34 197 94)".to_string()),
..Default::default()
},
ProgressRingSegment {
value: 15.0,
color: Some("rgb(59 130 246)".to_string()),
..Default::default()
},
]),
}
}
}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
Rust
Props — ProgressRing
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.