pub struct DropdownItem<A = ()> { /* private fields */ }Expand description
One action-menu row with optional action, icon, and reactive availability.
Empty and duplicate labels are allowed. Activating an enabled item without an action still closes the dropdown.
§Examples
use ailloli_ui_widgets::controls::DropdownItem;
let item: DropdownItem<()> = DropdownItem::new("Refresh").on_select(());
let _ = item;Implementations§
Source§impl<A: 'static> DropdownItem<A>
impl<A: 'static> DropdownItem<A>
Sourcepub fn new(label: impl Into<String>) -> Self
pub fn new(label: impl Into<String>) -> Self
Creates an enabled, iconless item with no action.
§Examples
use ailloli_ui_widgets::controls::DropdownItem;
let item: DropdownItem<()> = DropdownItem::new("Refresh");
let _ = item;Sourcepub fn on_select(self, action: impl IntoClickAction<A>) -> Self
pub fn on_select(self, action: impl IntoClickAction<A>) -> Self
Sets the activation action, replacing any previous action.
§Examples
use ailloli_ui_widgets::controls::DropdownItem;
#[derive(Clone)]
enum Action { Refresh }
let item = DropdownItem::new("Refresh").on_select(Action::Refresh);
let _ = item;Sourcepub fn disabled(self, disabled: impl Into<Binding<bool>>) -> Self
pub fn disabled(self, disabled: impl Into<Binding<bool>>) -> Self
Replaces the item’s static or reactive disabled binding.
§Examples
use ailloli_ui_widgets::controls::DropdownItem;
let item: DropdownItem<()> = DropdownItem::new("Unavailable").disabled(true);
let _ = item;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::DropdownItem;
let item: DropdownItem<()> = DropdownItem::new("Refresh")
.disabled_signal(Memo::new(|| false));
let _ = item;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::DropdownItem;
let item: DropdownItem<()> = DropdownItem::new("History").leading_icon(IconId::History);
let _ = item;Trait Implementations§
Auto Trait Implementations§
impl<A> Freeze for DropdownItem<A>
impl<A = ()> !RefUnwindSafe for DropdownItem<A>
impl<A = ()> !Send for DropdownItem<A>
impl<A = ()> !Sync for DropdownItem<A>
impl<A> Unpin for DropdownItem<A>
impl<A = ()> !UnwindSafe for DropdownItem<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
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.