Skip to content

Command Palette

NavigationSince 0.13.0

Keyboard-first command search in a modal dialog, opened with Ctrl+K (Cmd+K on Apple platforms; configurable) or open() from a button. A search field (a combobox) sits over a grouped, virtualized listbox driven by aria-activedescendant, so focus stays in the field. Fuzzy matching highlights the matched characters with text nodes. Sections list recent commands, the command groups, and async providers (debounced and aborted on each keystroke) with a loading state. Commands with children open a nested page (Backspace on an empty field goes back). An Empty State explains when nothing matches, and shortcuts are shown with Kbd. Commands are data: { id, label, keywords?, group?, description?, shortcut?, icon?, children?, disabled?, run? }. It uses the native modal <dialog> with the same focus restore, scroll lock, and overlay stack as Dialog.

  • Ctrl+K anywhereA modal command search with a configurable shortcut, shown with Kbd, and focus restored on close.
  • Fuzzy and highlightedSubsequence matching over labels and keywords; matched characters are marked with text nodes.
  • Sections and pagesRecent commands, groups, and nested pages: Enter opens a sub-list, Backspace goes back.
  • Async providersServer searches are debounced and aborted on each keystroke, with a loading state.
  • Virtualized resultsThousands of commands stay fast; the listbox keeps focus in the field with aria-activedescendant.

Use it for

  • Applications with many pages and actions where power users want to jump anywhere from the keyboard.
  • Global search that combines local commands with server results (people, records, documents).

Use something else for

  • As the only way to reach a feature: every command must also be reachable through visible navigation.
  • Choosing a value in a form: use Combobox or Select.
  • A short menu of actions for one object: use Menu or Context Menu.
Anatomy
<div class="aui-command-palette">
<dialog class="aui-command-palette__dialog" aria-label="Command palette" open>
<div class="aui-command-palette__search">
<span class="aui-command-palette__search-icon" aria-hidden="true"></span>
<div class="aui-command-palette__crumbs" hidden><button class="aui-command-palette__back" aria-label="Back"></button><span class="aui-command-palette__trail">Change theme</span></div>
<input class="aui-command-palette__input" role="combobox" aria-expanded="true" aria-controls="list" aria-activedescendant="opt-3">
<span class="aui-command-palette__spinner" aria-hidden="true" hidden></span>
</div>
<div class="aui-command-palette__list" id="list" role="listbox" aria-label="Results">
<div class="aui-command-palette__canvas" role="none">
<div class="aui-command-palette__header" role="presentation">Navigation</div>
<div class="aui-command-palette__option aui-command-palette__option--active" role="option" aria-selected="true" id="opt-3">
<span class="aui-command-palette__icon"></span>
<span class="aui-command-palette__text"><span class="aui-command-palette__label">Go to <mark class="aui-command-palette__match">peo</mark>ple</span></span>
<span class="aui-command-palette__shortcut aui-kbd">...</span>
</div>
</div>
</div>
<div class="aui-command-palette__empty" hidden>(Empty State)</div>
<div class="aui-command-palette__error" hidden></div>
<div class="aui-command-palette__footer" aria-hidden="true">(key hints with Kbd)</div>
<div class="aui-command-palette__status" role="status">12 results</div>
</dialog>
</div>

Use the bar above each frame to switch theme, density, direction, and locale.

Command Palette in the Navigation and commands showcase

Section titled “Command Palette in the Navigation and commands showcase”

The part of the Navigation and commands showcase that uses Command Palette. Change its options, use it with the keyboard, and watch the event log; the link in the frame opens the full showcase. The bar above the frame switches theme, density, direction, and locale.

Showcase source
// Navigation and commands showcase: a document tree with lazy folders, drag-and-drop,
// rename, checkboxes, and a filter; a Tree Select for a department; and a command palette
// opened with Ctrl+K (Cmd+K) or a button, with nested pages and a simulated people search.
import { Button } from '@absoluteui/components/button';
import { CommandPalette, type Command, type CommandPaletteSelectDetail } from '@absoluteui/components/command-palette';
import { TextInput } from '@absoluteui/components/text-input';
import { TreeSelect, type TreeSelectChangeDetail } from '@absoluteui/components/tree-select';
import { TreeView, type TreeNode, type TreeViewSelectDetail } from '@absoluteui/components/tree-view';
import { action, choice, createShowcase, section, status, toggle, wait } from './kit.js';
const sc = createShowcase({
title: 'Navigation and commands',
description: 'Browse the company documents (folders load when opened), drag or cut and paste to reorganize, press F2 to rename, pick a department, and press Ctrl+K (Cmd+K) for the command palette.',
simulated: true,
});
const DOCUMENTS: TreeNode[] = [
{ id: 'policies', label: 'Policies', icon: 'list-bulleted', children: [
{ id: 'leave', label: 'Leave policy', icon: 'file' },
{ id: 'travel', label: 'Travel policy', icon: 'file' },
{ id: 'expenses', label: 'Expenses policy', icon: 'file' },
{ id: 'remote', label: 'Remote work policy', icon: 'file' },
] },
{ id: 'handbook', label: 'Employee handbook', icon: 'list-bulleted', children: [
{ id: 'welcome', label: 'Welcome', icon: 'file' },
{ id: 'benefits', label: 'Benefits', icon: 'list-bulleted', children: [{ id: 'health', label: 'Health insurance', icon: 'file' }, { id: 'pension', label: 'Pension plan', icon: 'file' }] },
{ id: 'conduct', label: 'Code of conduct', icon: 'file' },
] },
{ id: 'payroll', label: 'Payroll (loads on open)', icon: 'list-bulleted', hasChildren: true },
{ id: 'archive', label: 'Archive (loads on open)', icon: 'list-bulleted', hasChildren: true },
{ id: 'legal', label: 'Legal hold (fails to load)', icon: 'list-bulleted', hasChildren: true },
{ id: 'board', label: 'Board minutes (restricted)', icon: 'file', disabled: true },
];
let failNext = true;
const docsArea = section(sc, 'Company documents', ['tree-view']);
const docsStatus = status(docsArea);
docsStatus.textContent = 'Nothing selected.';
const filterHost = document.createElement('div');
const treeHost = document.createElement('div');
docsArea.append(filterHost, treeHost);
const tree = TreeView.create(treeHost, {
label: 'Company documents',
nodes: DOCUMENTS,
selection: 'single',
expanded: ['policies'],
draggable: true,
renamable: true,
height: '20rem',
// Folders other than Policies and Handbook are leaves, so documents cannot be dropped into files.
canDrop: (_source, target, position) => position !== 'inside' || target === null || target.icon === 'list-bulleted',
loadChildren: async (node, { signal }) => {
await wait(700, signal);
if (node.id === 'legal' && failNext) {
failNext = false;
throw new Error('Simulated server error');
}
return Array.from({ length: node.id === 'archive' ? 60 : 6 }, (_, i) => ({ id: `${node.id}-${String(i + 1)}`, label: `${node.id === 'payroll' ? 'Payslip run' : 'Record'} ${String(2025 - Math.floor(i / 12))}-${String((i % 12) + 1).padStart(2, '0')}`, icon: 'file' }));
},
});
sc.listen(treeHost, ['aui-select', 'aui-change', 'aui-expand', 'aui-move', 'aui-rename', 'aui-activate', 'aui-load-error'], 'tree');
treeHost.addEventListener('aui-select', (e) => {
const id = (e as CustomEvent<TreeViewSelectDetail>).detail.selected[0];
docsStatus.textContent = id === undefined ? 'Nothing selected.' : `Selected: ${tree.getNode(id)?.label ?? id}.`;
});
const filter = TextInput.create(filterHost, { label: 'Filter documents', type: 'search', description: 'Matches stay visible with the folders that contain them.' });
filterHost.addEventListener('aui-input', () => {
tree.update({ filter: filter.value });
});
toggle(sc, 'Checkboxes', false, (checkboxes) => {
tree.update({ checkboxes, selection: checkboxes ? 'none' : 'single' });
}, ['tree-view']);
toggle(sc, 'Multiple selection', false, (multiple) => {
tree.update({ selection: multiple ? 'multiple' : 'single', selected: [] });
}, ['tree-view']);
toggle(sc, 'Drag and drop', true, (draggable) => {
tree.update({ draggable });
}, ['tree-view']);
action(sc, 'Expand all', () => {
tree.expandAll();
}, ['tree-view']);
action(sc, 'Collapse all', () => {
tree.collapseAll();
}, ['tree-view']);
action(sc, 'Rename the selected document', () => {
const id = tree.selected[0] ?? tree.activeId;
if (id !== null) tree.rename(id);
}, ['tree-view']);
const pickArea = section(sc, 'Department', ['tree-select']);
const pickStatus = status(pickArea);
const DEPARTMENTS: TreeNode[] = [
{ id: 'eng', label: 'Engineering', children: [{ id: 'eng-web', label: 'Web' }, { id: 'eng-platform', label: 'Platform' }, { id: 'eng-data', label: 'Data and AI' }] },
{ id: 'ops', label: 'Operations', children: [{ id: 'ops-facilities', label: 'Facilities' }, { id: 'ops-it', label: 'IT support' }, { id: 'ops-security', label: 'Security' }] },
{ id: 'people', label: 'People and Culture', children: [{ id: 'people-recruiting', label: 'Recruiting' }, { id: 'people-learning', label: 'Learning' }] },
{ id: 'finance', label: 'Finance', children: [{ id: 'finance-payroll', label: 'Payroll' }, { id: 'finance-tax', label: 'Tax' }] },
];
const selectHost = document.createElement('div');
pickArea.append(selectHost);
const department = TreeSelect.create(selectHost, { label: 'Department', name: 'department', required: true, placeholder: 'Choose a department', description: 'Type to filter; Down Arrow moves into the tree.', nodes: DEPARTMENTS });
sc.listen(selectHost, ['aui-change'], 'tree-select');
selectHost.addEventListener('aui-change', (e) => {
const { value } = (e as CustomEvent<TreeSelectChangeDetail>).detail;
pickStatus.textContent = value.length === 0 ? 'No department chosen.' : `Chosen: ${value.join(', ')}.`;
});
choice(sc, 'Department mode', [{ value: 'single', label: 'One department' }, { value: 'multiple', label: 'Several (checkboxes)' }], 'single', (mode) => {
department.update({ mode, value: [] });
}, ['tree-select']);
toggle(sc, 'Teams only (parents open)', false, (teamsOnly) => {
department.update({ selectableParents: !teamsOnly });
}, ['tree-select']);
const cmdArea = section(sc, 'Command palette', ['command-palette']);
const cmdStatus = status(cmdArea);
cmdStatus.textContent = 'Press Ctrl+K (Cmd+K) or the button.';
const PEOPLE = ['Ada Lovelace', 'Alan Turing', 'Barbara Liskov', 'Donald Knuth', 'Edsger Dijkstra', 'Grace Hopper', 'Katherine Johnson', 'Margaret Hamilton', 'Radia Perlman', 'Tim Berners-Lee'];
const commands: Command[] = [
{ id: 'go-dashboard', label: 'Go to dashboard', group: 'Navigation', icon: 'menu' },
{ id: 'go-directory', label: 'Go to directory', group: 'Navigation', keywords: ['people', 'employees'], icon: 'menu' },
{ id: 'go-documents', label: 'Go to documents', group: 'Navigation', icon: 'menu', run: () => { tree.focusNode('policies'); } },
{ id: 'request-leave', label: 'Request leave', group: 'Actions', shortcut: 'Mod+Shift+L', icon: 'calendar', keywords: ['vacation', 'holiday'] },
{ id: 'new-document', label: 'New document', group: 'Actions', shortcut: 'Mod+N', icon: 'plus' },
{ id: 'export', label: 'Export report (no permission)', group: 'Actions', icon: 'download', disabled: true },
{ id: 'theme', label: 'Change theme', group: 'Preferences', icon: 'eye', children: [
{ id: 'theme-light', label: 'Light' },
{ id: 'theme-dark', label: 'Dark' },
{ id: 'theme-contrast', label: 'High contrast' },
] },
{ id: 'density', label: 'Change density', group: 'Preferences', icon: 'align-justify', children: [
{ id: 'density-compact', label: 'Compact' },
{ id: 'density-comfortable', label: 'Comfortable' },
{ id: 'density-spacious', label: 'Spacious' },
] },
];
const paletteHost = document.createElement('div');
cmdArea.append(paletteHost);
const palette = CommandPalette.create(paletteHost, {
commands,
recent: ['go-directory'],
placeholder: 'Search pages, actions, and people',
providers: [{
id: 'people',
label: 'People',
minQueryLength: 2,
search: async (query, { signal }) => {
await wait(350, signal);
const q = query.toLowerCase();
return PEOPLE.filter((p) => p.toLowerCase().includes(q)).map((p) => ({ id: `person-${p}`, label: p, description: 'Employee', icon: 'search' }));
},
}],
});
sc.listen(paletteHost, ['aui-select', 'aui-open', 'aui-close'], 'palette');
paletteHost.addEventListener('aui-select', (e) => {
const d = (e as CustomEvent<CommandPaletteSelectDetail>).detail;
cmdStatus.textContent = `Chose ${d.command.label}${d.path.length > 0 ? ` (in ${d.path.join(' / ')})` : ''}.`;
});
const openButton = Button.create({ text: 'Open command palette', icon: 'search', variant: 'secondary' });
openButton.element.addEventListener('click', () => {
palette.open();
});
cmdArea.append(openButton.element);
choice(sc, 'Palette shortcut', [{ value: 'Mod+K', label: 'Ctrl+K / Cmd+K' }, { value: 'Mod+Shift+P', label: 'Ctrl+Shift+P / Cmd+Shift+P' }], 'Mod+K', (shortcut) => {
palette.update({ shortcut });
}, ['command-palette']);
action(sc, 'Open on the theme page', () => {
palette.open({ page: 'theme' });
}, ['command-palette']);
Section titled “Navigation, actions, nested pages, and a server provider”
import { CommandPalette, type Command, type CommandPaletteSelectDetail } from '@absoluteui/components/command-palette';
const commands: Command[] = [
{ id: 'go-home', label: 'Go to dashboard', group: 'Navigation', icon: 'menu', run: () => { location.hash = '#/'; } },
{ id: 'go-people', label: 'Go to people', group: 'Navigation', keywords: ['employees', 'directory'], run: () => { location.hash = '#/people'; } },
{ id: 'leave', label: 'Request leave', group: 'Actions', shortcut: 'Mod+Shift+L', run: () => { location.hash = '#/leave/new'; } },
{ id: 'theme', label: 'Change theme', group: 'Actions', children: [
{ id: 'theme-light', label: 'Light' },
{ id: 'theme-dark', label: 'Dark' },
] },
];
const host = document.createElement('div');
document.body.append(host);
const palette = CommandPalette.create(host, {
commands,
providers: [{
id: 'people',
label: 'People',
minQueryLength: 2,
search: async (query, { signal }) => {
const res = await fetch(`/api/people?q=${encodeURIComponent(query)}`, { signal });
const people = (await res.json()) as { id: string; name: string }[];
return people.map((p) => ({ id: `person-${p.id}`, label: p.name, icon: 'search' }));
},
}],
});
host.addEventListener('aui-select', (event) => {
const { id } = (event as CustomEvent<CommandPaletteSelectDetail>).detail;
if (id.startsWith('theme-')) document.documentElement.dataset.theme = id.slice(6);
});
const button = document.createElement('button');
button.textContent = 'Search';
button.addEventListener('click', () => { palette.open(); });
document.body.append(button);

A different shortcut and remembered recent commands

Section titled “A different shortcut and remembered recent commands”
import { CommandPalette } from '@absoluteui/components/command-palette';
const host = document.createElement('div');
document.body.append(host);
const saved = sessionStorage.getItem('recent-commands');
const palette = CommandPalette.create(host, {
shortcut: 'Mod+Shift+P',
recent: saved ? (JSON.parse(saved) as string[]) : [],
commands: [
{ id: 'save', label: 'Save', shortcut: 'Mod+S' },
{ id: 'print', label: 'Print', shortcut: 'Mod+P' },
],
});
host.addEventListener('aui-close', () => {
sessionStorage.setItem('recent-commands', JSON.stringify(palette.recent));
});
Terminal window
npm install @absoluteui/components @absoluteui/core @absoluteui/theme

Registry setup, the theme stylesheet, and the Content Security Policy are covered in Installation.

import { CommandPalette } from '@absoluteui/components/command-palette';
import '@absoluteui/components/kbd/style.css';
import '@absoluteui/components/button/style.css';
import '@absoluteui/components/empty-state/style.css';
import '@absoluteui/components/command-palette/style.css';
import { CommandPalette } from '@absoluteui/components/command-palette';
import '@absoluteui/components/kbd/style.css';
import '@absoluteui/components/button/style.css';
import '@absoluteui/components/empty-state/style.css';
import '@absoluteui/components/command-palette/style.css';
const host = document.createElement('div');
document.body.append(host);
CommandPalette.create(host, { commands: [{ id: 'help', label: 'Open help', run: () => { location.hash = '#/help'; } }] });
More usage
import { CommandPalette } from '@absoluteui/components/command-palette';
const host = document.createElement('div');
document.body.append(host);
const palette = CommandPalette.create(host, {
commands: [
{ id: 'new', label: 'New document', group: 'File', shortcut: 'Mod+N', run: () => { location.hash = '#/new'; } },
{ id: 'settings', label: 'Open settings', group: 'Navigation', run: () => { location.hash = '#/settings'; } },
],
});
document.querySelector('#search-button')?.addEventListener('click', () => { palette.open(); });

Using Angular? See Command Palette for Angular.

CommandPalette.create(host: HTMLElement, options: CommandPaletteOptions): CommandPalette

Global configuration key: commandPalette (see Configuration).

Option Type Default Description
commands readonly Command[] Commands: { id, label, keywords?, group?, description?, shortcut?, icon?, children?, disabled?, run? }. Required.
label string "Command palette" Accessible name of the dialog.
placeholder string "Type a command or search" Search field placeholder.
providers readonly CommandProvider[] Async searches ({ id, label, search(query, { signal }), minQueryLength? }), listed after the commands.
recent readonly string[] "[]" Command ids shown in the Recent section while the query is empty.
recentLimit number "5" Most recent commands remembered (0 hides the section).
maxResults number "50" Most results per section.
icons Partial<CommandPaletteIcons> Search, loading, back, and submenu icons.
shortcut string | null "Mod+K" Hotkey that opens and closes the palette (matchesHotkey syntax; Mod is Cmd on Apple platforms, Ctrl elsewhere); null for none. Globally configurable.
debounce number "200" Milliseconds between the last keystroke and provider searches (0 to 2000). Globally configurable.
overscan number "6" Rows rendered beyond each edge of the visible area. Globally configurable.
locale string "en-US" Locale of messages and matching. Globally configurable. Inherited from common configuration.
density 'compact' | 'comfortable' | 'spacious' "comfortable" Row height. Globally configurable. Inherited from common configuration.
Property Type Description
host HTMLElement The host element (holds the dialog).
dialog HTMLDialogElement The native modal dialog.
input HTMLInputElement The search field (role=combobox).
isOpen boolean Whether the palette is open.
query string The current search text.
recent string[] Recent command ids, most recent first.
path string[] Ids of the open nested pages.
options Readonly<CommandPaletteOptions> Current options.
Method Description
open(options?: { page?: string; query?: string }): void Open, optionally on a command’s nested page and with a query.
close(): void Close and restore focus.
toggle(): void Open or close.
setQuery(query: string): void Replace the search text and search.
update(options: Partial<CommandPaletteOptions>): void Merge and apply options.
destroy(): void Close, remove the dialog and the shortcut listener, abort searches.
Event Detail Bubbles Cancelable Description
aui-select CommandPaletteSelectDetail Yes Yes A command was chosen: { id, command, path, query, providerId }; preventDefault() skips command.run. The palette closes first.
aui-open null No No The palette opened.
aui-close null No No The palette closed.

All rules live in the aui.components cascade layer, so application styles override them without specificity battles.

Class Purpose
aui-command-palette Host (display: contents).
aui-command-palette__dialog | __dialog--loading The modal dialog; loading state.
aui-command-palette__search | __search-icon | __input | __spinner Search row, icon, field, and loading indicator.
aui-command-palette__crumbs | __back | __trail Nested page trail and back button.
aui-command-palette__list | __canvas Result listbox and its positioning layer.
aui-command-palette__header Section header (role=presentation).
aui-command-palette__option | __option--active A result (role=option) and the active one.
aui-command-palette__icon | __text | __label | __match | __description | __shortcut | __submenu Result parts.
aui-command-palette__empty | __error | __footer | __hint | __status Empty State host, provider error, key hints, and the live status.
Slot Default icon
search search
loading spinner
back chevron-left
submenu chevron-right

Tokens this stylesheet reads (verified in CI). Override them in a theme or with the Theme Designer.

--aui-border-width | --aui-color-backdrop | --aui-color-border | --aui-color-error-fg | --aui-color-focus-ring | --aui-color-hover | --aui-color-selected | --aui-color-selected-indicator | --aui-color-selected-text | --aui-color-surface | --aui-color-text | --aui-color-text-disabled | --aui-color-text-muted | --aui-control-height-md | --aui-duration-fast | --aui-easing-standard | --aui-focus-ring-width | --aui-font-family-sans | --aui-font-size-lg | --aui-font-size-md | --aui-font-size-sm | --aui-font-weight-semibold | --aui-icon-size-sm | --aui-line-height-normal | --aui-radius-lg | --aui-radius-pill | --aui-radius-sm | --aui-shadow-lg | --aui-space-1 | --aui-space-2 | --aui-space-3 | --aui-space-4 | --aui-touch-target-min

TypeScript definitions
interface Command {
readonly id: string;
readonly label: string;
readonly keywords?: readonly string[];
readonly group?: string;
readonly description?: string;
readonly shortcut?: string;
readonly icon?: IconRef;
readonly children?: readonly Command[];
readonly disabled?: boolean;
readonly run?: () => void;
}
interface CommandProvider { readonly id: string; readonly label: string; readonly search: (query: string, context: { readonly signal: AbortSignal }) => Promise<readonly Command[]>; readonly minQueryLength?: number }
interface CommandPaletteConfig { shortcut: string | null; debounce: number; overscan: number }
interface CommandPaletteOptions extends Partial<CommandPaletteConfig> {
commands: readonly Command[];
label?: string;
placeholder?: string;
providers?: readonly CommandProvider[];
recent?: readonly string[];
recentLimit?: number;
maxResults?: number;
locale?: string;
density?: Density;
icons?: Partial<CommandPaletteIcons>;
}
interface CommandPaletteSelectDetail { id: string; command: Command; path: string[]; query: string; providerId: string | null }

Pattern: Modal dialog (native <dialog>, inert background) containing a WAI-ARIA 1.2 combobox whose listbox is always shown: focus stays in the search field and aria-activedescendant points at the active option. Section headers are presentational rows; the active option always stays rendered while the list is virtualized.

Checked on every docs build: the showcase passes axe (WCAG 2.2 A and AA rules) in the default, dark, and high-contrast themes and right to left; the playground loads without errors and passes axe before and after every on/off option is switched, with no Content Security Policy violations.

Key Context Action
Ctrl + K (Cmd + K) Page Open or close the palette (the shortcut option).
Down / Up Search field Next or previous result (wraps).
Page Down / Page Up Search field Move by one visible page.
Ctrl + Home / Ctrl + End Search field First or last result.
Enter Search field Choose the active result: run it, or open its nested page.
Backspace Empty search field on a nested page Go back one page.
Escape Dialog Close and return focus to where it was.
Tab Dialog Stays inside the modal dialog (native focus containment).
Element Role
dialog dialog (native, modal)
search field combobox
results listbox
result option
section header presentation
status status
Attribute Element Value
aria-label dialog the label option (default Command palette)
aria-label combobox Search commands
aria-expanded / aria-controls / aria-autocomplete combobox true / the listbox id / list
aria-activedescendant combobox id of the active option
aria-description combobox the nested page trail while on a nested page
aria-selected option true on the active option
aria-disabled option true for disabled commands
aria-haspopup option listbox for commands with children
aria-busy listbox true while providers search

Opening moves focus to the search field and remembers the previously focused element; closing (Escape, backdrop click, or a chosen command) restores it before the command runs. The background is inert while the dialog is open.

Criterion Level Note
1.3.1 Info and Relationships A
1.4.1 Use of Color A
1.4.11 Non-text Contrast AA
2.1.1 Keyboard A
2.1.2 No Keyboard Trap A
2.4.3 Focus Order A
2.4.7 Focus Visible AA
4.1.2 Name, Role, Value A
4.1.3 Status Messages AA

Automated test results: Accessibility and compliance.

  • The number of results is announced politely after typing pauses (WCAG 4.1.3); an empty result shows an Empty State with the reason.
  • The active result is shown by a start-edge bar as well as color (WCAG 1.4.1).
  • The shortcut is shown in the footer hints and next to each command with Kbd (with spoken names for symbols).
  • Section names are visible headers but not part of the options’ accessible names.
  • Manual screen-reader verification (NVDA, JAWS, VoiceOver) is pending.
Import cost Minified gzip brotli CSS brotli
@absoluteui/components/command-palette 66.7 kB 22.2 kB 19.8 kB 1.5 kB

Measured at build time, including every AbsoluteUI module the component pulls in. No third-party runtime dependencies.

Budget (enforced in CI) Limit
Filtering 10,000 commands per keystroke < 30 ms in headless Chromium
Rendered result rows visible rows + 2 x overscan + 1

Tested scale: 10,000 commands with nested pages; at most 100,000 commands. maxResults (default 50) limits each section.

Local matching is one pass per keystroke over the current page (the top level includes nested commands). Provider searches are debounced and aborted. Only visible + 2 x overscan + 1 rows exist.

Measured run times: Performance.

States

Closed; open; recent; filtering; loading; provider failed; no results; nested page; disabled command.

State transitions
From Trigger To
closed shortcut, open() open, focus in the field, Recent and all commands listed
open typing local results now; provider results after debounce (loading spinner, aria-busy)
open Enter on a command with children nested page (trail shown)
nested page Backspace on an empty field, back button previous page
open Enter or click on a command aui-select, closed, focus restored, then run()
open Escape, backdrop click, shortcut closed, focus restored
Accessibility notes
  • Opening remembers the focused element and closing restores it before the command runs (WCAG 2.4.3).
  • The result count is announced after typing pauses (WCAG 4.1.3).
  • The active result has a start-edge bar as well as color (WCAG 1.4.1).
  • The e2e axe run covers three themes with the palette open; manual screen-reader verification is pending.
Responsive behavior

At most 40rem wide and never wider than the viewport minus a gutter; the result list grows with its content up to 24rem or 55% of the viewport height.

Right-to-left

The field, results, and footer follow the writing direction; the back and submenu chevrons are mirrored.

Theming

Three themes through the role tokens; forced colors use Highlight and HighlightText for the active result; matches keep their underline.

Global configuration
configureAbsoluteUI({ components: { commandPalette: { shortcut: 'Mod+Shift+P', debounce: 300 } } });
Component configuration

Instance shortcut, debounce, overscan, locale, and density override configuration.

Icons

icons.search (search), icons.loading (spinner), icons.back (chevron-left), icons.submenu (chevron-right); command icons come from command.icon.

Security

Labels, descriptions, and headers are text; matches are <mark> elements built from text nodes. Provider results are validated (id and label strings) before rendering; invalid results count as a failure.

Data handling

Recent ids are kept in memory only; persist recent yourself if needed. Providers are the application’s functions and receive an AbortSignal that aborts when the query changes or the palette closes.

Supported data scale

Tested with 10,000 commands; at most 100,000. maxResults limits each section (default 50).

Edge cases
  • A provider that rejects or returns invalid data is skipped and “Some results could not be loaded.” is shown.
  • Typing while a provider search is pending aborts it.
  • Disabled commands are listed but cannot be chosen or made active.
  • An invalid shortcut on a command is not shown (the row still renders).
Errors
Code Category Cause
COMMAND_PALETTE_OPTIONS configuration Commands not an array, a command without a string id or label, duplicate ids, non-function run, invalid keywords, invalid providers, non-string recent ids, or recentLimit/maxResults outside 0 to 1000.
CFG_INVALID_VALUE / CFG_UNKNOWN_OPTION configuration Invalid or unknown configuration (for example a debounce above 2000).
Known limitations
  • One row height per density; long labels are truncated.
  • Providers run at the top level only.
  • The default shortcut Ctrl+K overrides the browser’s search shortcut while the page has focus.
  • Manual screen-reader verification is pending.
Unsupported scenarios
  • Rich (HTML) labels or custom row renderers.
  • Several palettes on one page listening to the same shortcut.