pub struct Select { /* private fields */ }Expand description
Searchable dropdown select component
§Example
use armas_basic::components::{Select, SelectOption};
let options = vec![
SelectOption::new("apple", "Apple"),
SelectOption::new("banana", "Banana"),
SelectOption::new("cherry", "Cherry"),
];
let mut select = Select::new(options)
.selected("apple")
.placeholder("Pick a fruit...");
select.show(ui);Implementations§
Source§impl Select
impl Select
Sourcepub fn new(options: Vec<SelectOption>) -> Self
pub fn new(options: Vec<SelectOption>) -> Self
Create a new Select component with the given options
Sourcepub fn build(builder: impl FnOnce(&mut SelectBuilder)) -> Self
pub fn build(builder: impl FnOnce(&mut SelectBuilder)) -> Self
Build a Select using a closure-based API (prefer using Select::new())
Sourcepub fn placeholder(self, placeholder: impl Into<String>) -> Self
pub fn placeholder(self, placeholder: impl Into<String>) -> Self
Set placeholder text shown when no option is selected
Sourcepub const fn max_height(self, height: f32) -> Self
pub const fn max_height(self, height: f32) -> Self
Set the maximum height of the dropdown menu
Sourcepub const fn searchable(self, searchable: bool) -> Self
pub const fn searchable(self, searchable: bool) -> Self
Enable or disable search functionality
Sourcepub const fn font_size(self, size: f32) -> Self
pub const fn font_size(self, size: f32) -> Self
Set font size (overrides height-derived default)
Sourcepub const fn corner_radius(self, radius: u8) -> Self
pub const fn corner_radius(self, radius: u8) -> Self
Set corner radius (overrides default 6)
Sourcepub const fn padding_x(self, padding: f32) -> Self
pub const fn padding_x(self, padding: f32) -> Self
Set horizontal padding (overrides height-derived default)
Sourcepub fn selected_value(&self) -> Option<&str>
pub fn selected_value(&self) -> Option<&str>
Get the currently selected value
Sourcepub fn set_selected(&mut self, value: Option<String>)
pub fn set_selected(&mut self, value: Option<String>)
Set the selected value programmatically
Sourcepub fn show(&mut self, ui: &mut Ui) -> SelectResponse
pub fn show(&mut self, ui: &mut Ui) -> SelectResponse
Show the Select component
Auto Trait Implementations§
impl Freeze for Select
impl RefUnwindSafe for Select
impl Send for Select
impl Sync for Select
impl Unpin for Select
impl UnsafeUnpin for Select
impl UnwindSafe for Select
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