Search documentation

Search the documentation and open a page.

A command menu for searching and selecting actions.

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/command

Composition

<app-command> | <app-command-dialog> ├── <app-command-input> └── [app-command-list] ├── [app-command-empty] ├── [app-command-group] │ ├── [app-command-group-label] │ └── <app-command-item> │ ├── [app-command-item-text] │ └── [app-command-shortcut] (optional) └── [app-command-separator] (optional)

Examples

Default

Loading...

Dialog

Loading...

Empty

Loading...

In A Popover

Loading...

Nested Pages

Loading...

With Tabs

Loading...

Workspace Switcher

Loading...

API Reference

<app-command>

Inputs

InputTypeDefaultDescription
collectionListCollection<T>requiredCollection that supplies the command items, values, and display strings.
idstring | undefinedgeneratedUnique identifier used to create IDs for the command parts.
idsListboxElementIds | undefined—Overrides generated identifiers for individual parts.
valuestring[] | undefined—Selected values when controlled. Supports Angular two-way binding.
defaultValuestring[] | undefined[]Initially selected values when uncontrolled.
highlightedValuestring | null | undefined—Highlighted item value when controlled. Supports Angular two-way binding.
defaultHighlightedValuestring | null | undefinednullInitially highlighted item value when uncontrolled.
disabledbooleanfalseDisables interaction with the command.
loopFocusbooleanfalseWraps keyboard navigation from the last item to the first and vice versa.
disallowSelectAllbooleanfalsePrevents selecting every item with the select-all keyboard shortcut.
deselectablebooleanfalseAllows a selected item to be deselected.
selectOnHighlightbooleanfalseSelects an item as soon as it becomes highlighted.
typeaheadboolean | undefinedtrueEnables typeahead navigation.
orientation"horizontal" | "vertical" | undefined"vertical"Sets the keyboard navigation axis.
selectionModeListboxSelectionMode | undefined"single"Sets single, multiple, or extended selection behavior.
scrollToIndexFn((details: ListboxScrollToIndexDetails) => void) | undefined—Customizes scrolling when the highlighted item changes.

Outputs

OutputTypeDescription
valueChangestring[] | undefinedEmits the current selected values.
highlightedValueChangestring | null | undefinedEmits the current highlighted item value.
valueChangeDetailsListboxValueChangeDetails<T>Emits details whenever the selected values change.
highlightChangeListboxHighlightChangeDetails<T>Emits details whenever the highlighted item changes.
selectListboxSelectionDetailsEmits when an item is selected.

<app-command-dialog>

Inputs

InputTypeDefaultDescription
openboolean | undefined—Controls whether the command dialog is open.
titlestring"Command Palette"Accessible title rendered for the dialog.
descriptionstring"Search for a command to run..."Accessible description rendered for the dialog.
showCloseButtonbooleanfalseShows the dialog close button.
classstring""Adds classes to the generated dialog content.

Outputs

OutputTypeDescription
openChangebooleanEmits whenever the dialog open state changes.

<app-command-input>

Inputs

InputTypeDefaultDescription
placeholderstring""Placeholder displayed by the generated search input.
valuestring""Current search text. Supports Angular two-way binding.

Outputs

OutputTypeDescription
valueChangestringEmits the current search text.
filterstringEmits search text for filtering the command collection.

<app-command-item>

Inputs

InputTypeDefaultDescription
itemTrequiredCollection item represented by this command option.
highlightOnHoverboolean | undefinedtrueHighlights the item when the pointer moves over it.

[app-command-group]

Inputs

InputTypeDefaultDescription
idstring | undefinedgeneratedIdentifier shared with the group label.

Context, Providers, and Utilities

ExportAngular API
ListboxRootProviderDirective [listbox-root-provider] providing an externally created API.
ListboxContextStructural directive [listbox-context] exposing the root API to a template.
ListboxItemContextDirectiveStructural directive [listbox-item-context] exposing the current item state.
useListbox(options)Creates the signal-backed listbox machine inside an Angular injection context.
injectListboxContext()Injects the nearest command/listbox root context.
injectListboxItemContext()Injects the nearest command-item context.
createListCollection(options)Creates the typed collection consumed by the command.
useListCollection(options)Creates and manages a signal-backed list collection.
CommandImportsReadonly collection containing the command UI and context helpers.

Types

ExportDescription
ListboxApi<T>Connected command/listbox state and actions.
ListboxElementIdsOverrides for generated command part IDs.
ListboxValueChangeDetails<T>Details emitted by valueChangeDetails.
ListboxHighlightChangeDetails<T>Details emitted by highlightChange.
ListboxSelectionDetailsDetails emitted by select.
ListboxItemStateHighlighted, selected, and disabled state for an item.
ListboxSelectionModeSupported single, multiple, and extended selection modes.
UseListboxReturn<T>Signal-backed listbox machine returned by useListbox.