Pick a value roughly within a range.
For an exact value, use a number control.
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 slider --to ../my-appFiles copied: src/widgets/slider.rs, src/widgets/mod.rs, src/widgets/number.rs
Usage
use amenui::widgets::{slider};
fn view() -> El<Msg> {
slider("sl1", 40.0, Spec { min: 0.0, max: 100.0, step: 1.0, decimals: 0, unit: "" }, 240.0, Msg::Value)
}API
| Functions | slider |
|---|---|
| Props | key, value, spec, width, msg. |
| Files | src/widgets/slider.rs |
| Depends on | base, number |
| 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 | rest, focused, dragging (captured until release; the thumb turns to the accent). |
|---|---|
| Keys and messages | msg(v) while dragging and on Left / Right / Home / End. |
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).