#[non_exhaustive]pub struct SelectionValue<'a> {
pub selected_items: &'a [SharedString],
pub selected_indices: &'a [usize],
pub selected_keys: Option<&'a [SharedString]>,
pub selected_text: &'a str,
pub is_placeholder: bool,
pub default_children: AnyElement,
}Expand description
v3’s value render props, as one value.
Select.Value, Autocomplete.Value and ComboBox.Value all hand their
children a function and pass in {defaultChildren, isPlaceholder, selectedItems, selectedText}. defaultChildren is what the slot would have
drawn, so a caller can wrap it instead of rebuilding it – which is what v3’s
own examples do (if (isPlaceholder) return defaultChildren).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.selected_items: &'a [SharedString]selectedItems — the chosen items’ text. The order is the component’s
selection order: Select walks the collection, while ComboBox and
Autocomplete follow their selection set’s insertion order, the way
pinned react-stately 3.49.0’s Set iterates.
selected_indices: &'a [usize]Where those items sit in the collection, for a caller keyed by index,
in the same order as selected_items.
selected_keys: Option<&'a [SharedString]>The chosen items’ keys, in selection insertion order, when the
component’s collection is keyed and those keys are distinct from the
labels (Autocomplete, ComboBox). Select is index-keyed and
carries no distinct key here. selected_items and selected_indices
only contain entries for keys that currently resolve to collection
items, so async-loaded or missing keys can make their lengths differ
from selected_keys.
selected_text: &'a strselectedText — the same items joined. Select approximates v3’s en-US
list formatter; the other two use plain comma-space in this port.
is_placeholder: boolisPlaceholder — nothing is chosen, so the placeholder shows.
default_children: AnyElementdefaultChildren — the element this slot would have drawn.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for SelectionValue<'a>
impl<'a> !Send for SelectionValue<'a>
impl<'a> !Sync for SelectionValue<'a>
impl<'a> !UnwindSafe for SelectionValue<'a>
impl<'a> Freeze for SelectionValue<'a>
impl<'a> Unpin for SelectionValue<'a>
impl<'a> UnsafeUnpin for SelectionValue<'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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more