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

docs / components / feedback / tooltip docs / components / feedback /

tooltip

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

A short description shown while a control is hovered or focused.

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 tooltip --to ../my-app

Files copied: src/widgets/tooltip.rs, src/widgets/mod.rs

Usage

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

fn view() -> El<Msg> {
    tooltip("tt1", button("tb", "保存", Msg::Nothing), "保存到本机", true)
}

API

Functionstooltip
Propskey, target (the control), tip, shown.
Filessrc/widgets/tooltip.rs
Depends onbase
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

Stateshidden, shown (below the target, never taking input).
Keys and messagesnone (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).