Move between pages of results.
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 pagination --to ../my-appFiles copied: src/widgets/pagination.rs, src/widgets/mod.rs
Usage
use amenui::widgets::{pagination};
fn view() -> El<Msg> {
pagination("pg1", 2, 12, Msg::Pick)
}API
| Functions | pagination |
|---|---|
| Props | key, page (0-based), pages, msg. |
| Files | src/widgets/pagination.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 | the current page marked; previous / next disabled at the ends. |
|---|---|
| Keys and messages | msg(i); numbers are keyed key:i, the steps key/prev, key/next. |
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).