amenui
en·中 github ↗ v0.0.1
01docs 02components 03lab 04works
en·中github ↗
×

docs / components / feedback / popover docs / components / feedback /

popover

04.20
On this page ▾
  1. Installation
  2. Usage
  3. API
  4. Keyboard and accessibility

Rich content in a layer anchored to a button.

drawn by amenuiopen ↗

Installation

Components are distributed as source. Copy it and what it depends on into your project, then change it as you need:

sh
cargo run --release --bin amenui -- add popover --to ../my-app

Files copied: src/widgets/popover.rs, src/widgets/mod.rs, src/widgets/button.rs

Usage

rust
use amenui::widgets::{popover};

fn view() -> El<Msg> {
    popover("po1", "分享", false, Msg::Nothing, Msg::Nothing, text("链接", 13.0, Paint::TEXT))
}

API

Functionspopover
Propskey, trigger (its label), open, toggle, close, body.
Filessrc/widgets/popover.rs
Depends onbase, button
Response to frontsnudge (a control: pushed as one piece by fronts, held and condensing at most to Look::legible_cap)
Recompositionkeyed labels recompose when their text changes

Keyboard and accessibility

Statesclosed, open (a panel below the trigger, focus moves into it).
Keys and messagestoggle 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).