Skip to content

Controls

Radio buttons, segmented buttons and switches.

Example

Size

Delivery

Show code
use zeyn::prelude::*;

pub fn overview(_ctx: &Ctx) -> Node {
    Form::of(Choices { size: Size::Medium, ..Choices::default() })
        .field(Choices::size)
        .control(Choices::size, Control::Segmented)
        .field(Choices::delivery)
        .control(Choices::delivery, Control::Radio)
        .field(Choices::gift)
        .control(Choices::gift, Control::Switch)
        .submit("Save", save_choices)
        .on_success(|_, ui| ui.toast("Saved. Nothing was stored."))
        .into()
}