Skip to main content

meter_html

Function meter_html 

Source
pub fn meter_html(meter: &Meter<'_>, opts: &Emit) -> String
Expand description

A meter as a filled trough.

use makeover_layout::{Meter, Tone};
use makeover_webview::{Emit, meter::meter_html};

let meter = Meter::new(3, 7).tone(Tone::Success).label("subtasks");
let html = meter_html(&meter, &Emit::default());

assert!(html.contains(r#"aria-label="3 of 7 subtasks""#));
assert!(html.contains(r#"data-tone="success""#));
assert!(html.contains("width: 42%"));

aria-valuenow is clamped to aria-valuemax, because a value outside the range is invalid ARIA and a screen reader is entitled to ignore the whole element. The unclamped truth is in the accessible name, which is read either way.