Show longer content in a fixed height, scrolled with the wheel; a thin bar at one side shows the position.
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 scroll-area --to ../my-appFiles copied: src/widgets/scroll.rs, src/widgets/mod.rs
Usage
use amenui::widgets::{scroll_area};
fn view() -> El<Msg> {
scroll_area("sa1", 120.0, col().gap(6.0).children((0..12).map(|i| text(format!("第 {} 行", i + 1), 13.0, Paint::TEXT))))
}API
| Functions | scroll_area |
|---|---|
| Props | key, height, body. |
| Files | src/widgets/scroll.rs |
| Depends on | base |
| Response to fronts | inherits (text inside is nudged and legible) |
| Recomposition | keyed labels recompose when their text changes |
Keyboard and accessibility
| States | scroll offset kept by the runtime by key; a thin bar shows where it is. |
|---|---|
| Keys and messages | none. |
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).