Progress
Shows how far a task has advanced.
This demo runs the real GPUI component on WebGPU, which this browser does not expose.
Try Chrome or Edge 113+, or Safari 26+. In Firefox, enable dom.webgpu.enabled.
You can also run it natively: cargo run -p showcase progress
The demo failed to start in this browser.
You can run it natively instead: cargo run -p showcase progress
Live examples are not supported on most mobile browsers yet — open this page on a desktop or tablet to run the demo.
Recent phones with WebGPU may manage it (downloads ~18 MB):
#Anatomy
Import the component's parts and compose them under its root:
use base_gpui::progress::{
ProgressIndicator,
ProgressLabel,
ProgressRoot,
ProgressTrack,
ProgressValue,
};
ProgressRoot::new()
.child(
ProgressLabel::new(),
)
.child(
ProgressTrack::new()
.child(
ProgressIndicator::new(),
),
)
.child(
ProgressValue::new(),
);
The anatomy is a structural overview. Parts with mutually exclusive modes may need separate instances; each part's section below documents its configuration.
#ProgressRoot
Coordinates the component's state and supplies context to its child parts.
use base_gpui::progress::ProgressRoot;
ProgressRoot::new()
.id("example-id")
.value(0.0)
.min(0.0)
.max(0.0)
.format(0.0)
.label("label")
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a ProgressRoot with its default configuration. |
.id | pub fn id(mut self, id: impl Into<ElementId>) -> Self
Sets the stable GPUI element identity. Use a unique value when multiple instances can appear in the same view. |
.child | pub fn child(mut self, child: impl Into<ProgressChild>) -> Self
Adds one typed child to this part. |
.children | pub fn children(mut self, children: impl IntoIterator<Item = impl Into<ProgressChild>>,) -> Self
Adds multiple typed children in iteration order. |
.child_any | pub fn child_any(mut self, child: impl IntoElement) -> Self
Adds one arbitrary renderable child to this part. |
.value | pub fn value(mut self, value: Option<f64>) -> Self
The task-completion value; |
.min | pub fn min(mut self, min: f64) -> Self
Sets the min configuration for this part. |
.max | pub fn max(mut self, max: f64) -> Self
Sets the max configuration for this part. |
.format | pub fn format(mut self, format: impl Fn(f64) -> String + 'static) -> Self
Custom formatter receiving the raw (unclamped) value; never invoked when indeterminate. |
.label | pub fn label(mut self, label: impl Into<SharedString>) -> Self
Accessible label for the progress bar; the literal-string replacement for Base UI's |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(ProgressStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. ProgressRoot also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#ProgressIndicator
Visual representation of the component's current state or value.
use base_gpui::progress::ProgressIndicator;
ProgressIndicator::new()
.with_progress_context(/* context: ProgressContext */)
.id("example-id")
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a ProgressIndicator with its default configuration. |
.with_progress_context | pub fn with_progress_context(mut self, context: ProgressContext) -> Self
Sets the with progress context configuration for this part. |
.id | pub fn id(mut self, id: impl Into<ElementId>) -> Self
Sets the stable GPUI element identity. Use a unique value when multiple instances can appear in the same view. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(ProgressStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. ProgressIndicator also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#ProgressLabel
Provides a visible label and associated accessibility semantics.
use base_gpui::progress::ProgressLabel;
ProgressLabel::new()
.with_progress_context(/* context: ProgressContext */)
.id("example-id")
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a ProgressLabel with its default configuration. |
.with_progress_context | pub fn with_progress_context(mut self, context: ProgressContext) -> Self
Sets the with progress context configuration for this part. |
.id | pub fn id(mut self, id: impl Into<ElementId>) -> Self
Sets the stable GPUI element identity. Use a unique value when multiple instances can appear in the same view. |
.child | pub fn child(mut self, child: impl IntoElement) -> Self
Adds one typed child to this part. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(ProgressStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. ProgressLabel also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#ProgressTrack
Visual track containing the component's indicator or thumb.
use base_gpui::progress::ProgressTrack;
ProgressTrack::new()
.with_progress_context(/* context: ProgressContext */)
.id("example-id")
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a ProgressTrack with its default configuration. |
.with_progress_context | pub fn with_progress_context(mut self, context: ProgressContext) -> Self
Sets the with progress context configuration for this part. |
.id | pub fn id(mut self, id: impl Into<ElementId>) -> Self
Sets the stable GPUI element identity. Use a unique value when multiple instances can appear in the same view. |
.child | pub fn child(mut self, child: impl Into<ProgressTrackChild>) -> Self
Adds one typed child to this part. |
.child_any | pub fn child_any(mut self, child: impl IntoElement) -> Self
Adds one arbitrary renderable child to this part. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(ProgressStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. ProgressTrack also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#ProgressValue
Displays or edits the component's current value.
use base_gpui::progress::ProgressValue;
ProgressValue::new()
.with_progress_context(/* context: ProgressContext */)
.id("example-id")
.display(0.0)
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a ProgressValue with its default configuration. |
.with_progress_context | pub fn with_progress_context(mut self, context: ProgressContext) -> Self
Sets the with progress context configuration for this part. |
.id | pub fn id(mut self, id: impl Into<ElementId>) -> Self
Sets the stable GPUI element identity. Use a unique value when multiple instances can appear in the same view. |
.display | pub fn display(mut self, display: impl Fn(Option<&str>, Option<f64>) -> SharedString + 'static,) -> Self
Sets the display configuration for this part. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(ProgressStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. ProgressValue also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#Accessibility
Keyboard interaction and accessibility semantics are implemented by the component, independently of visual styling. Known limitations caused by missing GPUI accessibility primitives are documented in the module source and are not silently approximated.
#Stability
Base GPUI is pre-1.0. Builder names and state types may evolve as GPUI and this port mature.