Holds the place of content that is still loading.
Better: El::skeleton() on the real rows — the same tree and layout, text drawn as bars of the measured line widths, pictures as blocks; the Loading rules (a skeleton only after skeleton_after_ms 300, rows swapped in swap_stagger_ms 40 apart) decide what shows, and nothing moves when the content comes.
Installation
Components are distributed as source. Copy it and what it depends on into your project, then change it as you need:
cargo run --release --bin amenui -- add skeleton --to ../my-appFiles copied: src/widgets/skeleton.rs, src/widgets/mod.rs
Usage
use amenui::widgets::{skeleton, Loading};
fn view() -> El<Msg> {
row().gap(12.0).child(skeleton("sk1", 40.0, 40.0, true)).child(col().gap(8.0).child(skeleton("sk2", 180.0, 12.0, false)).child(skeleton("sk3", 120.0, 12.0, false)))
}API
| Functions | skeleton, Loading |
|---|---|
| Props | key, width, height, round (a disc rather than a bar); for a list, Loading (skeleton_after_ms, swap_stagger_ms) and El::skeleton() on the real rows. |
| Files | src/widgets/skeleton.rs |
| Depends on | base |
| Response to fronts | nudge (a control: pushed as one piece by fronts, held and condensing at most to Look::legible_cap) |
| Recomposition | keyed labels recompose when their text changes |
Keyboard and accessibility
| States | nothing yet (the first skeleton_after_ms), skeleton, content (row by row); it stays still: no shimmer, loading is not an animation here. |
|---|---|
| Keys and messages | none. |
On the web every control is mirrored into the page as an element with its role and name, so screen readers and the browser's own focus see it (DESIGN.md §1.14).
Recipes: A list that loads