Expand description
Progress — a non-interactive horizontal bar showing how full a
0.0..=1.0 value is. Shaped like the shadcn / Radix Progress
primitive, scaled down to a single progress(value) builder
because Aetna progress bars don’t need to advertise their
indeterminate or label-bearing state — apps compose those around
the bar.
ⓘ
use aetna_core::prelude::*;
struct Storage { used_pct: u32 }
impl App for Storage {
fn build(&self, _cx: &BuildCx) -> El {
column([
row([
text("Storage").label(),
spacer(),
text(format!("{}%", self.used_pct)).muted(),
]),
progress(self.used_pct as f32 / 100.0),
])
}
}Progress paints the same way as the slider track + fill, minus the
thumb. There’s no apply_event because the widget is read-only —
apps update the underlying value through whatever channel they
own (timer tick, async snapshot, computed metric, …).
Constants§
- DEFAULT_
HEIGHT - Default bar height in logical pixels.
Functions§
- progress
- A horizontal progress bar.
valueis clamped to0.0..=1.0; the returnedEldefaults to filling its container’s width and a fixedDEFAULT_HEIGHT. Override with.height(...)/.width(...)like any El. - progress_
indeterminate - Indeterminate horizontal loader — same dimensions as
progress, but with a small bar ofbar_colorsliding back and forth across a muted track on a continuous loop. Use this in progress slots where no completion ratio is available (uploading to a server that doesn’t report bytes-sent, parsing a stream of unknown length, etc.). The runtime keeps the host loop ticking automatically while one is in the tree.