pub struct MaterialSelect<'a> { /* private fields */ }Expand description
Material Design select/dropdown component.
Select components allow users to choose one option from a list. They display the currently selected option in a text field-style input and show all options in a dropdown menu when activated.
§Example
let mut selected = Some(1);
ui.add(MaterialSelect::new(&mut selected)
.placeholder("Choose an option")
.option(0, "Option 1")
.option(1, "Option 2")
.option(2, "Option 3")
.helper_text("Select your preferred option"));Implementations§
Source§impl<'a> MaterialSelect<'a>
impl<'a> MaterialSelect<'a>
Sourcepub fn placeholder(self, placeholder: impl Into<String>) -> Self
pub fn placeholder(self, placeholder: impl Into<String>) -> Self
Sourcepub fn error_text(self, text: impl Into<String>) -> Self
pub fn error_text(self, text: impl Into<String>) -> Self
Sourcepub fn helper_text(self, text: impl Into<String>) -> Self
pub fn helper_text(self, text: impl Into<String>) -> Self
Sourcepub fn leading_icon(self, icon: impl Into<String>) -> Self
pub fn leading_icon(self, icon: impl Into<String>) -> Self
Sourcepub fn trailing_icon(self, icon: impl Into<String>) -> Self
pub fn trailing_icon(self, icon: impl Into<String>) -> Self
Sourcepub fn keep_open_on_select(self, keep_open: bool) -> Self
pub fn keep_open_on_select(self, keep_open: bool) -> Self
Set whether to keep the dropdown open after selecting an option.
§Arguments
keep_open- If true, the dropdown remains open after selection; if false, it closes (default behavior)
§Example
let mut selection = None;
ui.add(MaterialSelect::new(&mut selection)
.keep_open_on_select(true)); // Dropdown stays open after selectionTrait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for MaterialSelect<'a>
impl<'a> RefUnwindSafe for MaterialSelect<'a>
impl<'a> Send for MaterialSelect<'a>
impl<'a> Sync for MaterialSelect<'a>
impl<'a> Unpin for MaterialSelect<'a>
impl<'a> !UnwindSafe for MaterialSelect<'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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.