pub struct SelectOption<T> { /* private fields */ }Expand description
Typed select choice with a label, optional icon, and reactive availability.
Duplicate values and labels are allowed. Selection lookup uses the first equal value; a disabled option cannot be activated.
§Examples
use ailloli_ui_widgets::controls::SelectOption;
let option = SelectOption::new(1, "One").disabled(false);
let _ = option;Implementations§
Source§impl<T> SelectOption<T>
impl<T> SelectOption<T>
Sourcepub fn new(value: T, label: impl Into<String>) -> Self
pub fn new(value: T, label: impl Into<String>) -> Self
Creates an enabled, iconless option and stores its label unchanged.
§Examples
use ailloli_ui_widgets::controls::SelectOption;
let option = SelectOption::new("id", "Visible label");
let _ = option;Sourcepub fn disabled(self, disabled: impl Into<Binding<bool>>) -> Self
pub fn disabled(self, disabled: impl Into<Binding<bool>>) -> Self
Replaces the option’s static or reactive disabled binding.
§Examples
use ailloli_ui_widgets::controls::SelectOption;
let option = SelectOption::new(1, "One").disabled(true);
let _ = option;Sourcepub fn disabled_signal(self, disabled: Memo<bool>) -> Self
pub fn disabled_signal(self, disabled: Memo<bool>) -> Self
Uses a memo as the reactive disabled binding.
§Examples
use ailloli_ui_runtime::component::Memo;
use ailloli_ui_widgets::controls::SelectOption;
let option = SelectOption::new(1, "One").disabled_signal(Memo::new(|| false));
let _ = option;Sourcepub fn leading_icon(self, icon: IconId) -> Self
pub fn leading_icon(self, icon: IconId) -> Self
Sets the leading icon, replacing any previous one.
§Examples
use ailloli_ui_core::IconId;
use ailloli_ui_widgets::controls::SelectOption;
let option = SelectOption::new(1, "History").leading_icon(IconId::History);
let _ = option;Trait Implementations§
Source§impl<T: Clone> Clone for SelectOption<T>
impl<T: Clone> Clone for SelectOption<T>
Source§fn clone(&self) -> SelectOption<T>
fn clone(&self) -> SelectOption<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> Freeze for SelectOption<T>where
T: Freeze,
impl<T> !RefUnwindSafe for SelectOption<T>
impl<T> !Send for SelectOption<T>
impl<T> !Sync for SelectOption<T>
impl<T> Unpin for SelectOption<T>where
T: Unpin,
impl<T> !UnwindSafe for SelectOption<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.