Show content that needs attention above the page.
Until it closes, the rest of the page does not respond; Esc or the close button closes it.
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 dialog --to ../my-appFiles copied: src/widgets/dialog.rs, src/widgets/mod.rs, src/widgets/button.rs
Usage
use amenui::widgets::{dialog};
fn view() -> El<Msg> {
col().gap(8.0).child(button("rename", "重命名…", Msg::Nothing)).child(dialog("d1", false, "重命名", 320.0, 0.35, Msg::Nothing, text("新的名字", 14.0, Paint::TEXT)))
}API
| Functions | dialog |
|---|---|
| Props | key, open, title, width, beneath (looseness of the page under it, about 0.35), close, body. |
| Files | src/widgets/dialog.rs |
| Depends on | base, button |
| 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 | open or nothing; focus inside while open. |
|---|---|
| Keys and messages | close on Esc or 关闭; whatever its body sends. |
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 dialog