Choose one of a few visible options.
One focus stop; the arrows move and select.
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 radio --to ../my-appFiles copied: src/widgets/radio.rs, src/widgets/mod.rs
Usage
use amenui::widgets::{radio_group};
fn view() -> El<Msg> {
radio_group("r1", &["小", "中", "大"], 1, Msg::Pick)
}API
| Functions | radio_group |
|---|---|
| Props | key, options, current, msg. |
| Files | src/widgets/radio.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 | one option selected; one focus stop for the group. |
|---|---|
| Keys and messages | msg(i); options are keyed key:i. Arrow keys move the selection (WAI-ARIA radio group: Up/Left the previous, Down/Right the next, wrapping; Home / End the ends). |
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).