A short description shown while a control is hovered or focused.
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 tooltip --to ../my-appFiles copied: src/widgets/tooltip.rs, src/widgets/mod.rs
Usage
use amenui::widgets::{tooltip};
fn view() -> El<Msg> {
tooltip("tt1", button("tb", "保存", Msg::Nothing), "保存到本机", true)
}API
| Functions | tooltip |
|---|---|
| Props | key, target (the control), tip, shown. |
| Files | src/widgets/tooltip.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 | hidden, shown (below the target, never taking input). |
|---|---|
| Keys and messages | none (the application shows it from Ui::on_hover / focus; Esc hides it). |
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).