Rich content in a layer anchored to a button.
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 popover --to ../my-appFiles copied: src/widgets/popover.rs, src/widgets/mod.rs, src/widgets/button.rs
Usage
use amenui::widgets::{popover};
fn view() -> El<Msg> {
popover("po1", "分享", false, Msg::Nothing, Msg::Nothing, text("链接", 13.0, Paint::TEXT))
}API
| Functions | popover |
|---|---|
| Props | key, trigger (its label), open, toggle, close, body. |
| Files | src/widgets/popover.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 | closed, open (a panel below the trigger, focus moves into it). |
|---|---|
| Keys and messages | toggle on the trigger (Enter / Space too); close on Esc or a press outside. |
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).