Rows of records with named columns.
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 table --to ../my-appFiles copied: src/widgets/table.rs, src/widgets/mod.rs
Usage
use amenui::widgets::{table};
fn view() -> El<Msg> {
table("tb1", &[("名称", 120.0), ("大小", 60.0)], &[vec!["a.png".into(), "12 KB".into()], vec!["b.png".into(), "3 KB".into()]], Some(0), Msg::Pick)
}API
| Functions | table |
|---|---|
| Props | key, columns (name, width), rows (cells as text), selected, msg. |
| Files | src/widgets/table.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 | a selected row (highlighted); one focus stop, Up / Down move the selection. |
|---|---|
| Keys and messages | msg(i) on a row press or a key. |
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).