Skip to main content

progress

Function progress 

Source
pub fn progress<S>(
    label: impl Into<String>,
    percent: impl IntoExpr<S, i32>,
) -> El<S>
Expand description

A bar filled up to percent, a value from 0 to 100, named by label.

It is a role="progressbar" with aria-valuenow kept equal to the value, so a screen reader reads the label and the percentage. A value below 0 or above 100 is drawn and announced as 0 or 100.

use hypersig::Signals;
use hypersig_ui::progress;
use serde::{Deserialize, Serialize};

#[derive(Signals, Serialize, Deserialize)]
struct Upload {
    percent: i32,
}

let bar = progress::<Upload>("Uploading report.pdf", Upload::percent());
assert!(bar.render().contains(r#"role="progressbar""#));