Progress
Anatomy
Determinate and indeterminate progress bar indicators for file uploads, form steps, loading states, and real-time completion tracking.
maud_ui::primitives::progress
Props
Generated from public Rust fields. Defaults are evaluated from the implementation.
| Prop | Type | Default | Description |
|---|---|---|---|
value | u32 | 0 | Current progress value (0..=100, or use any value with max) |
max | u32 | 100 | Maximum value (default 100) |
label | String | "" | ARIA label for the progress bar |
indeterminate | bool | false | If true, renders as indeterminate (animated) progress |
Examples
File upload
Stepped progress
Indeterminate
With label + value helpers
Download complete
Usage and composition
Import
use maud_ui::primitives::progress::{self, Props};
Example
use maud::html;
use maud_ui::primitives::progress;
html! {
(progress::render(progress::Props {
value: 65,
max: 100,
label: "Uploading file, 65 percent".into(),
indeterminate: false,
}))
}
Variants
Determinate
Concrete progress: bar fills proportionally to value / max.
(progress::render(progress::Props {
value: 40,
max: 100,
label: "Sync status, 40 percent".into(),
indeterminate: false,
}))
Indeterminate
Animated bar for unknown duration (e.g., "processing...").
(progress::render(progress::Props {
indeterminate: true,
label: "Processing request".into(),
..Default::default()
}))
Helpers
label(text: &str) -> Markup
Renders a <span class="mui-progress__label"> for semantic label text. Matches shadcn ProgressLabel.
(progress::label("Download progress"))
value(val: u32) -> Markup
Renders a <span class="mui-progress__value"> displaying "{val}%". Matches shadcn ProgressValue.
(progress::value(75)) // Output: "75%"
Usage Pattern
Combine label, value, and render in a flex layout:
html! {
div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:0.5rem" {
(progress::label("Sync status"))
(progress::value(40))
}
(progress::render(progress::Props {
value: 40,
max: 100,
label: "Sync status, 40 percent".into(),
indeterminate: false,
}))
}
Related
Skeleton (loading placeholder), Spinner (busy indicator).
Shadcn reference
https://ui.shadcn.com/docs/components/base/progress
Accessibility
- Uses
role="progressbar"on the outer container. - Determinate:
aria-valuenow,aria-valuemin="0",aria-valuemax="{max}",aria-label="{label}". - Indeterminate:
aria-valuemin="0",aria-valuemax="{max}",aria-label="{label}"(novaluenow). - Label must be descriptive for screen readers (e.g., "Uploading file, 65 percent").