Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
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
| Input | Type | Default | Description |
|---|---|---|---|
collection | ListCollection<T> | required | Collection that supplies the command items, values, and display strings. |
id | string | undefined | generated | Unique identifier used to create IDs for the command parts. |
ids | ListboxElementIds | undefined | — | Overrides generated identifiers for individual parts. |
value | string[] | undefined | — | Selected values when controlled. Supports Angular two-way binding. |
defaultValue | string[] | undefined | [] | Initially selected values when uncontrolled. |
highlightedValue | string | null | undefined | — | Highlighted item value when controlled. Supports Angular two-way binding. |
defaultHighlightedValue | string | null | undefined | null | Initially highlighted item value when uncontrolled. |
disabled | boolean | false | Disables interaction with the command. |
loopFocus | boolean | false | Wraps keyboard navigation from the last item to the first and vice versa. |
disallowSelectAll | boolean | false | Prevents selecting every item with the select-all keyboard shortcut. |
deselectable | boolean | false | Allows a selected item to be deselected. |
selectOnHighlight | boolean | false | Selects an item as soon as it becomes highlighted. |
typeahead | boolean | undefined | true | Enables typeahead navigation. |
orientation | "horizontal" | "vertical" | undefined | "vertical" | Sets the keyboard navigation axis. |
selectionMode | ListboxSelectionMode | undefined | "single" | Sets single, multiple, or extended selection behavior. |
scrollToIndexFn | ((details: ListboxScrollToIndexDetails) => void) | undefined | — | Customizes scrolling when the highlighted item changes. |
Use [(value)]="selected" or [(highlightedValue)]="highlighted" for two-way binding. The
component also implements Angular's ControlValueAccessor for forms integration.
Outputs
| Output | Type | Description |
|---|---|---|
valueChange | string[] | undefined | Emits the current selected values. |
highlightedValueChange | string | null | undefined | Emits the current highlighted item value. |
valueChangeDetails | ListboxValueChangeDetails<T> | Emits details whenever the selected values change. |
highlightChange | ListboxHighlightChangeDetails<T> | Emits details whenever the highlighted item changes. |
select | ListboxSelectionDetails | Emits when an item is selected. |
<app-command-dialog>
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
open | boolean | undefined | — | Controls whether the command dialog is open. |
title | string | "Command Palette" | Accessible title rendered for the dialog. |
description | string | "Search for a command to run..." | Accessible description rendered for the dialog. |
showCloseButton | boolean | false | Shows the dialog close button. |
class | string | "" | Adds classes to the generated dialog content. |
Outputs
| Output | Type | Description |
|---|---|---|
openChange | boolean | Emits whenever the dialog open state changes. |
<app-command-input>
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
placeholder | string | "" | Placeholder displayed by the generated search input. |
value | string | "" | Current search text. Supports Angular two-way binding. |
Outputs
| Output | Type | Description |
|---|---|---|
valueChange | string | Emits the current search text. |
filter | string | Emits search text for filtering the command collection. |
<app-command-item>
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
item | T | required | Collection item represented by this command option. |
highlightOnHover | boolean | undefined | true | Highlights the item when the pointer moves over it. |
[app-command-group]
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
id | string | undefined | generated | Identifier shared with the group label. |
Context, Providers, and Utilities
| Export | Angular API |
|---|---|
ListboxRootProvider | Directive [listbox-root-provider] providing an externally created API. |
ListboxContext | Structural directive [listbox-context] exposing the root API to a template. |
ListboxItemContextDirective | Structural 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. |
CommandImports | Readonly collection containing the command UI and context helpers. |
Types
| Export | Description |
|---|---|
ListboxApi<T> | Connected command/listbox state and actions. |
ListboxElementIds | Overrides for generated command part IDs. |
ListboxValueChangeDetails<T> | Details emitted by valueChangeDetails. |
ListboxHighlightChangeDetails<T> | Details emitted by highlightChange. |
ListboxSelectionDetails | Details emitted by select. |
ListboxItemState | Highlighted, selected, and disabled state for an item. |
ListboxSelectionMode | Supported single, multiple, and extended selection modes. |
UseListboxReturn<T> | Signal-backed listbox machine returned by useListbox. |
Angular
React
Solid
Svelte
Vue