Find and run a command by typing.
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 command --to ../my-appFiles copied: src/widgets/command.rs, src/widgets/mod.rs, src/widgets/input.rs
Usage
use amenui::widgets::{command, command_matches};
fn view() -> El<Msg> {
command("cp1", &TextEdit::new("sa"), &["open file", "save all", "close window"], 0, Msg::Edit, Msg::Pick)
}API
| Functions | command, command_matches |
|---|---|
| Props | key, query (a TextEdit), items (labels), active, on_query, run. |
| Files | src/widgets/command.rs |
| Depends on | base, input |
| 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 | the query; the matching items (every typed character in order); one active. |
|---|---|
| Keys and messages | on_query(edit) while typing; Up / Down move active (through on_query of the same text with the arrow's step, see command_step); Enter run(i) (the item's index in items). |
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).