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

docs / components / layout / scroll-area docs / components / layout /

scroll-area

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

Show longer content in a fixed height, scrolled with the wheel; a thin bar at one side shows the position.

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

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

Usage

rust
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

Functionsscroll_area
Propskey, height, body.
Filessrc/widgets/scroll.rs
Depends onbase
Response to frontsinherits (text inside is nudged and legible)
Recompositionkeyed labels recompose when their text changes

Keyboard and accessibility

Statesscroll offset kept by the runtime by key; a thin bar shows where it is.
Keys and messagesnone.

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).