Function freya::components::Radio
pub fn Radio(__props: RadioProps) -> Option<VNode>
Expand description
Controlled Radio
component.
§Styling
Inherits the RadioTheme
theme.
§Example
#[derive(PartialEq)]
enum Choice {
First,
Second,
}
fn app() -> Element {
let mut selected = use_signal(|| Choice::First);
rsx!(
Tile {
onselect: move |_| selected.set(Choice::First),
leading: rsx!(
Radio {
selected: *selected.read() == Choice::First,
},
),
label { "First choice" }
}
Tile {
onselect: move |_| selected.set(Choice::Second),
leading: rsx!(
Radio {
selected: *selected.read() == Choice::Second,
},
),
label { "Second choice" }
}
)
}