pub struct RadioGroup<'a> { /* private fields */ }Expand description
Radio group for single selection from multiple options
§Example
ⓘ
let mut selected = Some("option1".to_string());
let response = RadioGroup::new(&mut selected)
.label("Choose one")
.show(ui, |group| {
group.option("option1", "First Option");
group.option("option2", "Second Option")
.description("This is the second option");
group.option("option3", "Third Option");
});
if response.changed {
println!("Selected: {:?}", response.selected);
}Implementations§
Source§impl<'a> RadioGroup<'a>
impl<'a> RadioGroup<'a>
Sourcepub const fn new(selected_value: &'a mut Option<String>) -> Self
pub const fn new(selected_value: &'a mut Option<String>) -> Self
Create a new radio group
§Arguments
selected_value- Mutable reference to the currently selected value
Sourcepub const fn disabled(self, disabled: bool) -> Self
pub const fn disabled(self, disabled: bool) -> Self
Set disabled state for all radios in the group
Sourcepub fn show<R>(
self,
ui: &mut Ui,
content: impl FnOnce(&mut RadioGroupBuilder<'_>) -> R,
) -> RadioGroupResponse
pub fn show<R>( self, ui: &mut Ui, content: impl FnOnce(&mut RadioGroupBuilder<'_>) -> R, ) -> RadioGroupResponse
Show the radio group with closure-based API
Auto Trait Implementations§
impl<'a> Freeze for RadioGroup<'a>
impl<'a> RefUnwindSafe for RadioGroup<'a>
impl<'a> Send for RadioGroup<'a>
impl<'a> Sync for RadioGroup<'a>
impl<'a> Unpin for RadioGroup<'a>
impl<'a> UnsafeUnpin for RadioGroup<'a>
impl<'a> !UnwindSafe for RadioGroup<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more