Skip to main content

spinner

Function spinner 

Source
pub fn spinner<S>(label: impl Into<String>) -> El<S>
Expand description

A turning ring named label, which marks work that has no known length.

It is a role="status" with aria-label set to label, and the ring inside it is hidden from assistive technology. A screen reader reads label where it reaches the spinner, and whether it also reads it as the spinner appears differs between screen readers, so say in text when the work finishes, such as in a Toast. The ring turns in the current text color, and four times slower for a visitor who asks for reduced motion. Use progress where the share done is known.

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

#[derive(Signals, Serialize, Deserialize)]
struct Upload {
    busy: bool,
}

let busy = spinner::<Upload>("Uploading").show(Upload::busy());
assert!(busy.render().contains(r#"role="status""#));