Module radio
Expand description
Radio buttons let users choose a single option from a bunch of options.
§Example
use iced::widget::{column, radio};
struct State {
selection: Option<Choice>,
}
#[derive(Debug, Clone, Copy)]
enum Message {
RadioSelected(Choice),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum Choice {
A,
B,
C,
All,
}
fn view(state: &State) -> Element<'_, Message> {
let a = radio(
"A",
Choice::A,
state.selection,
Message::RadioSelected,
);
let b = radio(
"B",
Choice::B,
state.selection,
Message::RadioSelected,
);
let c = radio(
"C",
Choice::C,
state.selection,
Message::RadioSelected,
);
let all = radio(
"All of the above",
Choice::All,
state.selection,
Message::RadioSelected
);
column![a, b, c, all].into()
}
Structs§
- A circular button representing a choice.
- The appearance of a radio button.
Enums§
- The possible status of a
Radio
button.
Traits§
- The theme catalog of a
Radio
.
Functions§
- The default style of a
Radio
button.
Type Aliases§
- A styling function for a
Radio
.