Fusuma

Components / Basics

radio

A radio button.

Try it

This is the Foundations page of the gallery, running in your browser: radio is on it, and it is the real widget. Press Run, then use it.

Live: Foundations, where radio is usedOpen full size

Also on this pagesectionwrapgridcardparagraph

A radio button.

Radios that belong together are one choice: the app keeps which is chosen and gives checked to each.

Signature

pub const fn radio<M>(text: &str, checked: bool) -> Radio<'_, M>

Methods

  • .on_select(message: M) -> Self — Sends message when it is chosen.

Example

use fusuma::{column, radio};
let chosen = 1;
let view = column((
    radio("Small", chosen == 0).on_select(0),
    radio("Medium", chosen == 1).on_select(1),
    radio("Large", chosen == 2).on_select(2),
));
let built = fusuma::doc::built::<i32, _>(&view);
assert_eq!(built.texts(), ["Small", "Medium", "Large"]);

All components · Source