Skip to content

Progress

Represents determinate or indeterminate task progress with composable labels and track.

Loading interactive demo…

#Import

Import progress from quickgui.

use quickgui::*;

#Usage

progress(0.4, 1.0).w(240.0).h(8.0).rounded(4.0)

#Anatomy

  • progress::root
  • progress::track
  • progress::indicator
  • progress::label
  • progress::value

#API reference

Expand an entry for its description and complete signature. A dash means no declaration default is documented.

Progress

View source
pub fn new(value: f64, maximum: f64) -> Self

Create a determinate indicator between `0.0` and `maximum`. A non-finite or non-positive maximum falls back to `1.0`; the value is clamped into range.

fractionpub fn fraction(fraction: f64) -> Self—

Create a determinate indicator from a `0.0..=1.0` completion fraction.

pub fn fraction(fraction: f64) -> Self
View source
indeterminatepub fn indeterminate() -> Self—

Create an indicator for work whose completion is unknown.

pub fn indeterminate() -> Self
View source
value_textpub fn value_text(mut self, text: impl Into<Arc<str>>) -> Self—

Attach a human-readable value such as `"3 of 12 files"`. Assistive technology prefers this over the raw number when present. An empty string clears it. The text is not rendered; the application owns every visible label.

pub fn value_text(mut self, text: impl Into<Arc<str>>) -> Self
View source
idpub fn id(mut self, id: impl Into<ElementId>) -> Self—

Give this indicator a stable identity so its label and value parts can be related to it. Without an identity the parts are still decorated, but QuickGUI cannot point the root's accessible name and description at them, so the application supplies its own `accessibility_label`. Existing code that never declares an identity is unchanged.

pub fn id(mut self, id: impl Into<ElementId>) -> Self
View source
formatpub fn format(mut self, format: ValueFormat) -> Self—

Attach a bounded value formatter, Base UI's `format` prop. The result is what [`Self::display_value`] returns for a caller-owned value part, and what assistive technology reads unless [`Self::value_text`] overrides it.

pub fn format(mut self, format: ValueFormat) -> Self
View source
statuspub fn status(&self) -> ProgressStatus—

Which of Base UI's three progress states this indicator is in.

pub fn status(&self) -> ProgressStatus
View source
statepub fn state(&self) -> ProgressPartState—

A copyable snapshot of what Base UI exposes as `data-*` attributes.

pub fn state(&self) -> ProgressPartState
View source
display_valuepub fn display_value(&self) -> Option<Arc<str>>—

The formatted text for a caller-owned value part, or `None` while indeterminate.

pub fn display_value(&self) -> Option<Arc<str>>
View source
accessible_valuepub fn accessible_value(&self) -> Option<Arc<str>>—

The text assistive technology reads for the value, if any. An explicit [`Self::value_text`] wins over [`Self::format`], matching Base UI's `getAriaValueText` precedence.

pub fn accessible_value(&self) -> Option<Arc<str>>
View source
label_idpub fn label_id(&self) -> Option<ElementId>—

Stable identity of the label part, when this indicator declares one.

pub fn label_id(&self) -> Option<ElementId>
View source
value_idpub fn value_id(&self) -> Option<ElementId>—

Stable identity of the value part, when this indicator declares one.

pub fn value_id(&self) -> Option<ElementId>
View source
track_idpub fn track_id(&self) -> Option<ElementId>—

Stable identity of the track part, when this indicator declares one.

pub fn track_id(&self) -> Option<ElementId>
View source
indicator_idpub fn indicator_id(&self) -> Option<ElementId>—

Stable identity of the indicator part, when this indicator declares one.

pub fn indicator_id(&self) -> Option<ElementId>
View source
current_valuepub const fn current_value(&self) -> Option<f64>—

Configures current value for this part.

pub const fn current_value(&self) -> Option<f64>
View source
maximumpub const fn maximum(&self) -> f64—

Configures maximum for this part.

pub const fn maximum(&self) -> f64
View source
is_indeterminatepub const fn is_indeterminate(&self) -> bool—

Configures is indeterminate for this part.

pub const fn is_indeterminate(&self) -> bool
View source
completionpub fn completion(&self) -> Option<f32>—

The `0.0..=1.0` completion fraction, or `None` while indeterminate. Applications use this to size a caller-owned fill.

pub fn completion(&self) -> Option<f32>
View source

Progress::root_with

View source
pub fn root_with(&self, root: Element) -> Element

Decorate an application-owned root without adding layout or appearance.

Progress::root

View source
pub fn root(&self) -> Element

Create the unstyled root part. Use [`Self::root_with`] to supply an existing element.

Progress::track_with

View source
pub fn track_with(&self, track: Element) -> Element

Decorate the caller-owned track that the fill is measured inside. The track is decoration: the root already carries the numeric value and bounds, so the track and everything under it stay out of the accessible name.

Progress::track

View source
pub fn track(&self) -> Element

Create the unstyled track part. Use [`Self::track_with`] to supply an existing element.

Progress::indicator_with

View source
pub fn indicator_with(&self, indicator: Element) -> Element

Hide an application-owned fill or animation from the accessible name.

Progress::indicator

View source
pub fn indicator(&self) -> Element

Create the unstyled indicator part. Use [`Self::indicator_with`] to supply an existing element.

Progress::label_with

View source
pub fn label_with(&self, label: Element) -> Element

Assign the stable mounted label target the root points at.

Progress::label

View source
pub fn label(&self) -> Element

Create the unstyled label part. Use [`Self::label_with`] to supply an existing element.

Progress::value

View source
pub fn value(&self) -> Element

Assign the stable mounted value target the root points at. Put [`Self::display_value`] inside it; QuickGUI never renders the text itself. Create the unstyled value text part.

Progress::value_with

View source
pub fn value_with(&self, value: Element) -> Element

progress

View source
pub fn progress(value: f64, maximum: f64) -> Element

Create an unstyled determinate progress root. This shorthand is equivalent to `Progress::new(value, maximum).root_with(div())`.