Progress Circle
Show progress along a circular arc.
use herogpui::components::progress::ProgressCircle;ProgressCircle on docs.rsSource at v0.14.0
Usage
Showing Usage, live: HeroGPUI compiled to WebAssembly. The canvas has no accessibility tree; each example's description and code below carry the same information.
An element expression with window: &mut Window and cx: &mut App in scope.
use herogpui::prelude::ProgressCircle;
use herogpui::gpui::prelude::*;
use herogpui::gpui::px;
use herogpui::gpui;
gpui::div()
.flex()
.flex_wrap()
.items_center()
.justify_center()
.gap(px(12.))
.children(vec![ProgressCircle::new().value(60.).into_any_element()])Determinate value changes interpolate the retained arc over 300ms ease-out stroke transition; reduced motion settles directly. Runs in a view's render: self is the view holding this example's state and cx is its Context<Self>.
use herogpui::prelude::{Button, ProgressCircle, Size, Variant};
use herogpui::gpui::prelude::*;
use herogpui::gpui::px;
use herogpui::gpui;
let circle_transition = self.demo_flag("progress-circle-transition", false);
let circle_value = if circle_transition { 85.0 } else { 25.0 };
gpui::div()
.flex()
.flex_wrap()
.items_center()
.justify_center()
.gap(px(12.))
.children(vec![
ProgressCircle::new()
.id("progress-circle-transition-ring")
.value(circle_value)
.into_any_element(),
Button::new("progress-circle-transition-toggle")
.label(if circle_transition { "Show 25%" } else { "Show 85%" })
.size(Size::Sm)
.variant(Variant::Secondary)
.on_press(cx.listener(move |this, _, _, cx| {
this.set_demo_flag("progress-circle-transition", !circle_transition);
cx.notify();
}))
.into_any_element(),
])An element expression with window: &mut Window and cx: &mut App in scope.
use herogpui::prelude::ProgressCircle;
use herogpui::gpui::prelude::*;
use herogpui::gpui::px;
use herogpui::gpui;
gpui::div()
.flex()
.flex_wrap()
.items_center()
.justify_center()
.gap(px(12.))
.children(vec![ProgressCircle::new()
.is_indeterminate(true)
.into_any_element()])An element expression with window: &mut Window and cx: &mut App in scope.
use herogpui::prelude::ProgressCircle;
use herogpui::gpui::prelude::*;
use herogpui::gpui::px;
use herogpui::gpui;
gpui::div()
.flex()
.flex_wrap()
.items_center()
.justify_center()
.gap(px(12.))
.children(vec![gpui::div()
.flex()
.items_center()
.gap(px(12.))
.child(ProgressCircle::new().value(75.))
.child(gpui::div().text_size(px(14.)).child("75% Complete"))
.into_any_element()])The stroke keeps a fixed 4/36 view-box ratio as the circle scales; custom SVG attributes are not exposed by this canvas-backed port. An element expression with window: &mut Window and cx: &mut App in scope.
use herogpui::prelude::{ProgressCircle, Size};
use herogpui::gpui::prelude::*;
use herogpui::gpui::px;
use herogpui::gpui;
gpui::div()
.flex()
.flex_wrap()
.items_center()
.justify_center()
.gap(px(12.))
.children(Size::ALL
.iter()
.map(|sz| {
{
let key = format!("progress-circle-size-{sz:?}");
ProgressCircle::new().value(60.).size(*sz)
.into_any_element()
}
}))An element expression with window: &mut Window and cx: &mut App in scope.
use herogpui::prelude::{Color, ProgressCircle};
use herogpui::gpui::prelude::*;
use herogpui::gpui::px;
use herogpui::gpui;
gpui::div()
.flex()
.flex_wrap()
.items_center()
.justify_center()
.gap(px(12.))
.children(Color::ALL
.iter()
.map(|c| {
{
let key = format!("progress-circle-color-{c:?}");
ProgressCircle::new().value(70.0).color(*c)
.into_any_element()
}
}))An element expression with window: &mut Window and cx: &mut App in scope.
use herogpui::prelude::{ProgressCircle, Size};
use herogpui::gpui::prelude::*;
use herogpui::gpui::px;
use herogpui::gpui;
gpui::div()
.flex()
.flex_wrap()
.items_center()
.justify_center()
.gap(px(12.))
.children(vec![
ProgressCircle::new()
.value(70.0)
.size(Size::Sm)
.into_any_element(),
ProgressCircle::new()
.value(70.0)
.size(Size::Md)
.into_any_element(),
ProgressCircle::new()
.value(70.0)
.size(Size::Lg)
.into_any_element(),
])Anatomy
Rust types
Progress Circle is assembled from these builders. The API reference lists each one.
Customization
Shared appearance belongs on ThemeBuilder::components and .recipe("name"). Typed builders change how Progress Circle looks at one call site. Every builder also carries sx for placement, width and flex: it takes GPUI's own styling methods and refines them over the component's root after the theme, so an instance override wins. Behaviour builders live in the API reference below.
Styling
| Method | Values | Description |
|---|---|---|
size(Size) | Size::Sm | Size::Md | Size::Lg | Selects the 20, 28 or 36px track diameter. |
color(Color) | Color::Default | Color::Accent | Color::Success | Color::Warning | Color::Danger | Semantic fill-circle stroke color. |
// The one slot for caller-owned low-level styling: GPUI's
// styling methods, refined over the root element last.
.sx(|el| {
el.bg(gpui::rgba(0xffa500ff)) // background
.text_color(gpui::rgba(0x000000ff)) // text
.w(gpui::px(13.)) // size
.h(gpui::px(12.))
})API reference
Against HeroUI v3.2.6: 13 entries ported, 5 partial, 1 not ported. Partial rows are marked in the tables; entries not ported are listed under each table with the reason.
Builders
| Builder | Values | Default | Description |
|---|---|---|---|
id( | string | — | Optional GPUI identity. A named ring reports role=progressbar with the same value range as ProgressBar. |
value( | number | 0 | Current progress value, clamped to the configured range. |
min_value( | number | 0 | Minimum value used to normalize progress. |
max_value( | number | 100 | Maximum value used to normalize progress. |
is_indeterminate( | true | | false | Shows a spinning quarter arc without exposing a value label. |
size( | Size:: | Size:: | Selects the 20, 28 or 36px track diameter. |
color( | Color:: | Color:: | Semantic fill-circle stroke color. |
format_options(Partial | Intl. | {style: "percent"} | Formats valueText; the local formatter covers common numeric styles without locale or CLDR data. |
value_content(Partial | AnyElement | | — | The local ValueLabel closure receives all three documented values, but arbitrary root children are not composed. |
value_content( | number | — | Normalized percentage handed to the value renderer. |
Parts
| Part | Description |
|---|---|
ProgressCircle | Root progress indicator and fixed-size layout box. |
ProgressCirclePartial | SVG track counterpart represented by a border ring and canvas arc; it is not separately composable. |
ProgressCirclePartial | Full default-color ring beneath the progress arc. |
ProgressCirclePartial | Semantic-color canvas arc with normalized sweep; custom SVG attributes are unavailable. |
States
| State | Builder | Description |
|---|---|---|
Determinate | fraction_of(value, min_value, max_value) | Arc sweep and value renderer follow the normalized value. |
Indeterminate | is_indeterminate | The track wrapper rotates the quarter arc and its full ring together once per second; reduced motion leaves both layers static. |
Not ported1 HeroUI entry not ported
| HeroUI v3 | Why it is not ported |
|---|---|
Disabled | The stylesheet has a disabled selector, but the documented component has no disabled prop and does not invent one. |