pub struct Select { /* private fields */ }Expand description
A select/dropdown widget with optional fuzzy search
Implementations§
Source§impl Select
impl Select
Sourcepub fn searchable(self, enable: bool) -> Self
pub fn searchable(self, enable: bool) -> Self
Enable fuzzy search when dropdown is open
Sourcepub fn highlight_fg(self, color: Color) -> Self
pub fn highlight_fg(self, color: Color) -> Self
Set highlight color for matched characters
Sourcepub fn placeholder(self, text: impl Into<String>) -> Self
pub fn placeholder(self, text: impl Into<String>) -> Self
Set placeholder text
Sourcepub fn selected_style(self, fg: Color, bg: Color) -> Self
pub fn selected_style(self, fg: Color, bg: Color) -> Self
Set selected item colors
Sourcepub fn selected_index(&self) -> usize
pub fn selected_index(&self) -> usize
Get selected index
Sourcepub fn select_next(&mut self)
pub fn select_next(&mut self)
Select next option
Sourcepub fn select_prev(&mut self)
pub fn select_prev(&mut self)
Select previous option
Sourcepub fn select_first(&mut self)
pub fn select_first(&mut self)
Select first option
Sourcepub fn select_last(&mut self)
pub fn select_last(&mut self)
Select last option
Sourcepub fn clear_query(&mut self)
pub fn clear_query(&mut self)
Clear search query
Sourcepub fn is_searchable(&self) -> bool
pub fn is_searchable(&self) -> bool
Check if searchable mode is enabled
Sourcepub fn filtered_options(&self) -> &[usize]
pub fn filtered_options(&self) -> &[usize]
Get filtered options (indices into original options)
Sourcepub fn visible_count(&self) -> usize
pub fn visible_count(&self) -> usize
Get number of visible (filtered) options
Sourcepub fn get_match(&self, option: &str) -> Option<FuzzyMatch>
pub fn get_match(&self, option: &str) -> Option<FuzzyMatch>
Get fuzzy match for an option
Sourcepub fn handle_key(&mut self, key: &Key) -> bool
pub fn handle_key(&mut self, key: &Key) -> bool
Handle key input, returns true if selection changed
Trait Implementations§
Source§impl Interactive for Select
impl Interactive for Select
Source§fn handle_key(&mut self, event: &KeyEvent) -> EventResult
fn handle_key(&mut self, event: &KeyEvent) -> EventResult
Handle keyboard event Read more
Source§fn handle_mouse(&mut self, event: &MouseEvent, area: Rect) -> EventResult
fn handle_mouse(&mut self, event: &MouseEvent, area: Rect) -> EventResult
Handle mouse event Read more
Source§impl StyledView for Select
impl StyledView for Select
Source§fn remove_class(&mut self, class: &str)
fn remove_class(&mut self, class: &str)
Remove a CSS class
Source§fn toggle_class(&mut self, class: &str)
fn toggle_class(&mut self, class: &str)
Toggle a CSS class
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