Skip to main content

SelectContext

Struct SelectContext 

Source
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

Source

pub fn current_value(&self) -> String

Current single-select value.

Source

pub fn current_values(&self) -> Vec<String>

Current multi-select values.

Source

pub fn current_values_peek(&self) -> Vec<String>

Current multi-select values without subscribing (peek).

Source

pub fn select_single(&mut self, val: &str)

Select a value in single-select mode: sets value, closes popup, fires callback.

Source

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.

Source

pub fn is_selected(&self, val: &str) -> bool

Check if a value is currently selected.

Source

pub fn is_open(&self) -> bool

Whether the popup is currently open.

Source

pub fn set_open(&mut self, is_open: bool)

Set the open state.

Source

pub fn toggle_open(&mut self)

Toggle the open state.

Source

pub fn highlight_next(&mut self)

Move highlight to the next visible non-disabled item.

Source

pub fn highlight_prev(&mut self)

Move highlight to the previous visible non-disabled item.

Source

pub fn highlight_first(&mut self)

Move highlight to the first visible non-disabled item.

Source

pub fn highlight_last(&mut self)

Move highlight to the last visible non-disabled item.

Source

pub fn type_ahead(&mut self, prefix: &str)

Type-ahead: find the first matching item by prefix.

Source

pub fn confirm_highlighted(&mut self)

Confirm the currently highlighted item (select or toggle).

Source

pub fn register_item(&mut self, entry: ItemEntry)

Register an item. Called on mount.

Source

pub fn deregister_item(&mut self, value: &str)

Deregister an item. Called on unmount.

Source

pub fn register_group(&mut self, entry: GroupEntry)

Register a group. Called on mount.

Source

pub fn deregister_group(&mut self, id: &str)

Deregister a group. Called on unmount.

Source

pub fn mark_has_input(&mut self)

Mark that an Input child has been mounted (switches to combobox mode).

Source

pub fn has_search_input(&self) -> bool

Check if this select has a search input (combobox variant).

Source

pub fn trigger_id(&self) -> String

ID for the trigger button element.

Source

pub fn listbox_id(&self) -> String

ID for the listbox popup element.

Source

pub fn item_id(&self, value: &str) -> String

ID for a specific option element.

Source

pub fn input_id(&self) -> String

ID for the search input element.

Source

pub fn group_label_id(&self, group_id: &str) -> String

ID for a group label element.

Source

pub fn active_descendant(&self) -> String

The aria-activedescendant value (highlighted item ID, or empty).

Source

pub fn autocomplete(&self) -> AutoComplete

Current autocomplete mode.

Source

pub fn open_on_focus(&self) -> bool

Whether dropdown opens on focus.

Source

pub fn is_multiple(&self) -> bool

Whether this is a multi-select.

Source

pub fn has_highlighted(&self) -> bool

Whether an item is currently highlighted.

Source

pub fn highlighted_value(&self) -> Option<String>

Get the currently highlighted value (if any).

Source

pub fn set_search_query(&mut self, query: String)

Set the search query text.

Trait Implementations§

Source§

impl Clone for SelectContext

Source§

fn clone(&self) -> SelectContext

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for SelectContext

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> InitializeFromFunction<T> for T

Source§

fn initialize_from_function(f: fn() -> T) -> T

Create an instance of this type from an initialization function
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<Ret> SpawnIfAsync<(), Ret> for Ret

Source§

fn spawn(self) -> Ret

Spawn the value into the dioxus runtime if it is an async block
Source§

impl<T, O> SuperFrom<T> for O
where O: From<T>,

Source§

fn super_from(input: T) -> O

Convert from a type to another type.
Source§

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

Source§

fn super_into(self) -> O

Convert from a type to another type.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more