Create

Navigation

Command

Copy page View as Markdown Open in ChatGPT Open in Claude

A command menu with a search field that filters the list as you type.

Usage#

app.component.ts
import { WDS_COMMAND } from '@wds/angular/command';

Examples#

Default#

Groups, icons, shortcuts and a disabled command. Selecting a command (click or Enter) fires wds-select with its value and label. Set label, placeholder and empty-text: their defaults are in Polish.

Calendar Search Emoji Calculator Profile Billing Settings

Dialog#

The palette in a wds-dialog, opened with a button or ⌘J / Ctrl+J. The dialog has a heading for screen readers, hidden visually. The shortcut is handled by the page.

Open command palette

Or press ⌘J · Selected: none

CalendarSearch EmojiCalculatorProfileBillingSettings

Scrollable#

A long list scrolls inside the palette; --wds-command-list-height sets its maximum height (default 288px).

Home Inbox Documents Folders New File New Folder Copy Cut Paste Delete Grid View List View Zoom In Zoom Out Profile Billing Settings Notifications Help & Support Calculator Calendar Image Editor Code Editor

Keywords#

The search ignores case and diacritics, so “lodz” finds “Łódź”. keywords adds words that match without being shown. The empty slot replaces the message shown when nothing matches.

Settings Billing Log out Łódź Zürich São Paulo
Nothing found. Try another word.

API References#

wds-command#

Command palette: a search field and a filtered list of commands. Focus stays in the search field; the arrow keys move the highlight (skipping disabled commands), Enter selects, Escape goes back to the first command. aria-activedescendant points to the highlighted command, and an aria-live region announces the number of results.

Attributes

AttributeTypeDefaultDescription
placeholderstring'Wpisz polecenie lub szukaj…'Placeholder of the search field.
empty-text.emptyTextstring'Brak wyników.'Message shown when nothing matches. The empty slot takes precedence.
labelstring'Szukaj poleceń'Accessible name of the search field and the list.
querystring''Search text. Setting it filters the list without firing wds-search.

Events

EventDescription
wds-selectCustomEvent<WdsCommandSelectDetail>A command is selected (click or Enter).
wds-searchCustomEvent<WdsCommandSearchDetail>The search text changes.

Slots

SlotDescription
(default)wds-command-group, wds-command-item, wds-command-separator.
emptyContent shown when nothing matches (instead of empty-text).

CSS parts (::part)

PartDescription
baseThe panel with the padding and the border.
searchThe search field (with the icon).
inputThe native <input>.
listThe list of commands.
emptyThe "no results" message.

CSS custom properties

PropertyDescription
--wds-command-border-colorBorder color of the panel (default --wds-border).
--wds-command-list-heightMaximum height of the list (default 288px).

wds-command-group#

A group of commands with a heading (role="group"). It hides when none of its commands match the search.

Attributes

AttributeTypeDefaultDescription
labelstring''Group heading (also the accessible name of the group).

Slots

SlotDescription
(default)wds-command-item.

CSS parts (::part)

PartDescription
labelThe group heading.

wds-command-item#

A command in the wds-command list (role="option"). The highlighted one has data-active.

Attributes

AttributeTypeDefaultDescription
valuestring''Value passed in wds-select.
labelstring | undefinedName used for search and in wds-select. Defaults to the text content.
keywordsstring''Extra words matched by the search (e.g. synonyms, abbreviations).
shortcutstring''Keyboard shortcut shown on the right, e.g. ⌘P. It is only displayed; handle the keys yourself.
variantWdsCommandItemVariant'default'destructive: the error color (e.g. "Delete").
disabledbooleanfalseDisables the command: it cannot be highlighted or selected.

Slots

SlotDescription
(default)An <svg> icon (16px) and the name of the command.

CSS parts (::part)

PartDescription
baseThe row with the padding.
shortcutThe keyboard shortcut.

wds-command-separator#

A decorative line between groups of commands, hidden from screen readers. Hidden while searching.

CSS parts (::part)

PartDescription
baseThe line.

Accessibility#

Screen reader#

The search field has role="combobox" with aria-controls pointing to the list (role="listbox"). Both are named by label; its default is in Polish (Szukaj poleceń), so set it.

Focus stays in the search field. aria-activedescendant points to the highlighted command (role="option", aria-selected="true"); disabled commands have aria-disabled="true".

Groups have role="group" named by their label. Separators are decorative: hidden from screen readers, and hidden while searching. Shortcuts are hidden from screen readers too; give icons aria-hidden="true".

A live region announces the number of results after each change of the search, and a hidden hint on the search field describes the keys. Both texts are built in and currently in Polish.

In a wds-dialog, give the dialog a heading (it can be hidden visually) so the dialog has a name.

Keyboard support#

KeyFunction
A–ZTyping filters the list; the first matching command is highlighted.
ArrowDownArrowUpMoves the highlight to the next or previous command, wrapping around; disabled commands are skipped.
EnterSelects the highlighted command.
EscapeMoves the highlight back to the first command. In a dialog, it also closes the dialog.
TabLeaves the palette: the commands are not in the tab sequence.
Footer