pub struct CommandItem<A = ()> { /* private fields */ }Expand description
One searchable command row with an optional action.
Filtering checks trimmed ASCII-lowercased query substrings against title, subtitle, and keywords. Shortcut hints are not searchable. Disabled commands remain visible but keyboard navigation skips them and activation is consumed without closing. Enabled commands close the palette even without an action.
§Examples
use ailloli_ui_widgets::controls::CommandItem;
let item: CommandItem<()> = CommandItem::new("Open file").keyword("search");
let _ = item;Implementations§
Source§impl<A: 'static> CommandItem<A>
impl<A: 'static> CommandItem<A>
Sourcepub fn new(title: impl Into<String>) -> Self
pub fn new(title: impl Into<String>) -> Self
Creates an enabled command with no optional metadata or action.
§Examples
use ailloli_ui_widgets::controls::CommandItem;
let item: CommandItem<()> = CommandItem::new("Open file");
let _ = item;Sourcepub fn subtitle(self, subtitle: impl Into<String>) -> Self
pub fn subtitle(self, subtitle: impl Into<String>) -> Self
Sets a searchable subtitle, replacing any previous value.
Empty text remains present and selects the two-line row layout.
§Examples
use ailloli_ui_widgets::controls::CommandItem;
let item: CommandItem<()> = CommandItem::new("Theme").subtitle("Change appearance");
let _ = item;Sourcepub fn shortcut(self, shortcut: impl Into<String>) -> Self
pub fn shortcut(self, shortcut: impl Into<String>) -> Self
Sets a non-searchable shortcut hint, replacing any previous value.
§Examples
use ailloli_ui_widgets::controls::CommandItem;
let item: CommandItem<()> = CommandItem::new("Open").shortcut("Ctrl+O");
let _ = item;Sourcepub fn keyword(self, keyword: impl Into<String>) -> Self
pub fn keyword(self, keyword: impl Into<String>) -> Self
Appends one searchable keyword without normalization or de-duplication.
§Examples
use ailloli_ui_widgets::controls::CommandItem;
let item: CommandItem<()> = CommandItem::new("Preferences").keyword("settings");
let _ = item;Sourcepub fn keywords(
self,
keywords: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn keywords( self, keywords: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Appends searchable keywords in iterator order.
Existing keywords remain, and duplicates/empty strings are retained.
§Examples
use ailloli_ui_widgets::controls::CommandItem;
let item: CommandItem<()> = CommandItem::new("Preferences")
.keywords(["settings", "configuration"]);
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 icon.
§Examples
use ailloli_ui_core::IconId;
use ailloli_ui_widgets::controls::CommandItem;
let item: CommandItem<()> = CommandItem::new("History").leading_icon(IconId::History);
let _ = item;Sourcepub fn disabled(self, disabled: impl Into<Binding<bool>>) -> Self
pub fn disabled(self, disabled: impl Into<Binding<bool>>) -> Self
Sets static or reactive disabled state.
Disabled commands remain searchable and visible but are skipped by navigation and cannot run or close the palette.
§Examples
use ailloli_ui_widgets::controls::CommandItem;
let item: CommandItem<()> = CommandItem::new("Unavailable").disabled(true);
let _ = item;Sourcepub fn on_select(self, action: impl IntoClickAction<A>) -> Self
pub fn on_select(self, action: impl IntoClickAction<A>) -> Self
Installs the action run when this enabled command activates.
A later call replaces it. Enabled activation closes even when no action is installed.
§Examples
use ailloli_ui_widgets::controls::CommandItem;
#[derive(Clone)]
enum Action { Open }
let item = CommandItem::new("Open").on_select(Action::Open);
let _ = item;Trait Implementations§
Auto Trait Implementations§
impl<A> Freeze for CommandItem<A>
impl<A = ()> !RefUnwindSafe for CommandItem<A>
impl<A = ()> !Send for CommandItem<A>
impl<A = ()> !Sync for CommandItem<A>
impl<A> Unpin for CommandItem<A>
impl<A = ()> !UnwindSafe for CommandItem<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
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.