Progress
Composable track and indicator parts for reporting task completion.
Like every gpui-base primitive, Progress supplies behavior and semantic structure without imposing a product visual language. Apply GPUI styles and compose the exported parts to match your design system.
Example
The single native Cargo entrypoint selects this primitive from the shared showcase implementation. The same showcase is compiled once for the WASM preview above.
cargo run -p gpui-base --example components -- progressImport
use gpui_base::{Progress, ProgressIndicator, ProgressTrack};Anatomy and API
The example composes Progress, ProgressIndicator, ProgressTrack. GPUI's standard styling and event traits provide presentation; these base types provide the interaction structure.
The authoritative module is components/progress.rs. Native and browser previews compile this same file.
State and events
Set the value on Progress; size and position ProgressIndicator inside ProgressTrack.
Keep controlled state on the parent render type or in a GPUI entity. Update it in callbacks and call cx.notify(); do not recreate persistent entities during every render.
Complete Rust example
The complete implementation used by the runnable showcase is embedded directly from Rust source:
use gpui::{IntoElement, ParentElement as _, Styled as _, div, px};
use gpui_base::{Progress, ProgressIndicator, ProgressTrack};
use super::super::BaseShowcase;
impl BaseShowcase {
pub(in super::super) fn progress(&self) -> impl IntoElement {
div()
.w_64()
.flex()
.flex_col()
.gap_2()
.text_xs()
.child(
div()
.flex()
.justify_between()
.child("Uploading assets")
.child("68%"),
)
.child(
Progress::new("example-progress").value(68.).child(
ProgressTrack::new()
.w_full()
.h(px(7.))
.border_1()
.border_color(super::example_rgb(0x171717))
.child(
ProgressIndicator::new()
.w(px(177.))
.h_full()
.bg(super::example_rgb(0x171717)),
),
),
)
.child(
div()
.flex()
.justify_between()
.text_sm()
.text_color(super::example_rgb(0x737373))
.child("Optimizing bundle")
.child("32%"),
)
.child(
Progress::new("example-progress-secondary")
.value(32.)
.child(
ProgressTrack::new()
.w_full()
.h(px(6.))
.border_1()
.border_color(super::example_rgb(0xa3a3a3))
.child(
ProgressIndicator::new()
.w(px(83.))
.h_full()
.bg(super::example_rgb(0x737373)),
),
),
)
}
}The command above supplies application initialization, window creation, and shared BaseShowcase state.
Accessibility
Expose task label and numeric value; use indeterminate state only when progress is unknown.
Notes
Use stable element IDs where accepted. Verify focus, hover, active, selected, disabled, reduced-motion, and high-contrast appearances in the consuming design system.