pub struct SelectContext { /* private fields */ }Expand description
Shared context for the select compound component tree.
Provided by super::select::Root and consumed by all child components.
Implementations§
Source§impl SelectContext
impl SelectContext
Sourcepub fn current_value(&self) -> String
pub fn current_value(&self) -> String
Current single-select value.
Sourcepub fn current_values(&self) -> Vec<String>
pub fn current_values(&self) -> Vec<String>
Current multi-select values.
Sourcepub fn current_values_peek(&self) -> Vec<String>
pub fn current_values_peek(&self) -> Vec<String>
Current multi-select values without subscribing (peek).
Sourcepub fn select_single(&mut self, val: &str)
pub fn select_single(&mut self, val: &str)
Select a value in single-select mode: sets value, closes popup, fires callback.
Sourcepub fn toggle_value(&mut self, val: &str)
pub fn toggle_value(&mut self, val: &str)
Toggle a value in multi-select mode: adds if absent, removes if present. Does NOT close the popup.
Sourcepub fn is_selected(&self, val: &str) -> bool
pub fn is_selected(&self, val: &str) -> bool
Check if a value is currently selected.
Sourcepub fn toggle_open(&mut self)
pub fn toggle_open(&mut self)
Toggle the open state.
Sourcepub fn highlight_next(&mut self)
pub fn highlight_next(&mut self)
Move highlight to the next visible non-disabled item.
Sourcepub fn highlight_prev(&mut self)
pub fn highlight_prev(&mut self)
Move highlight to the previous visible non-disabled item.
Sourcepub fn highlight_first(&mut self)
pub fn highlight_first(&mut self)
Move highlight to the first visible non-disabled item.
Sourcepub fn highlight_last(&mut self)
pub fn highlight_last(&mut self)
Move highlight to the last visible non-disabled item.
Sourcepub fn type_ahead(&mut self, prefix: &str)
pub fn type_ahead(&mut self, prefix: &str)
Type-ahead: find the first matching item by prefix.
Sourcepub fn confirm_highlighted(&mut self)
pub fn confirm_highlighted(&mut self)
Confirm the currently highlighted item (select or toggle).
Sourcepub fn register_item(&mut self, entry: ItemEntry)
pub fn register_item(&mut self, entry: ItemEntry)
Register an item. Called on mount.
Sourcepub fn deregister_item(&mut self, value: &str)
pub fn deregister_item(&mut self, value: &str)
Deregister an item. Called on unmount.
Sourcepub fn register_group(&mut self, entry: GroupEntry)
pub fn register_group(&mut self, entry: GroupEntry)
Register a group. Called on mount.
Sourcepub fn deregister_group(&mut self, id: &str)
pub fn deregister_group(&mut self, id: &str)
Deregister a group. Called on unmount.
Sourcepub fn mark_has_input(&mut self)
pub fn mark_has_input(&mut self)
Mark that an Input child has been mounted (switches to combobox mode).
Sourcepub fn has_search_input(&self) -> bool
pub fn has_search_input(&self) -> bool
Check if this select has a search input (combobox variant).
Sourcepub fn trigger_id(&self) -> String
pub fn trigger_id(&self) -> String
ID for the trigger button element.
Sourcepub fn listbox_id(&self) -> String
pub fn listbox_id(&self) -> String
ID for the listbox popup element.
Sourcepub fn group_label_id(&self, group_id: &str) -> String
pub fn group_label_id(&self, group_id: &str) -> String
ID for a group label element.
Sourcepub fn active_descendant(&self) -> String
pub fn active_descendant(&self) -> String
The aria-activedescendant value (highlighted item ID, or empty).
Sourcepub fn autocomplete(&self) -> AutoComplete
pub fn autocomplete(&self) -> AutoComplete
Current autocomplete mode.
Sourcepub fn open_on_focus(&self) -> bool
pub fn open_on_focus(&self) -> bool
Whether dropdown opens on focus.
Sourcepub fn is_multiple(&self) -> bool
pub fn is_multiple(&self) -> bool
Whether this is a multi-select.
Sourcepub fn has_highlighted(&self) -> bool
pub fn has_highlighted(&self) -> bool
Whether an item is currently highlighted.
Sourcepub fn highlighted_value(&self) -> Option<String>
pub fn highlighted_value(&self) -> Option<String>
Get the currently highlighted value (if any).
Sourcepub fn set_search_query(&mut self, query: String)
pub fn set_search_query(&mut self, query: String)
Set the search query text.
Trait Implementations§
Source§impl Clone for SelectContext
impl Clone for SelectContext
Source§fn clone(&self) -> SelectContext
fn clone(&self) -> SelectContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more