Skip to content
Alea0.1

Navigation

CommandPalette

Every action and page, searchable from the keyboard with ⌘K.

import { CommandPalette } from '@alea/ui';

Examples

Command palette

Press ⌘K (Ctrl+K) anywhere, or the button.

Props

CommandPalette props

Search every action and page from the keyboard (⌘K).

PropTypeDefaultDescription
commandsrequiredCommand[]-The commands, in groups: id, label, icon, shortcut, keywords and onAction.
emptyTextReactNode'No results'Shown when nothing matches.
hotkeybooleantrueOpens with ⌘K / Ctrl+K anywhere. Default true.
isOpenboolean-Whether it is open (controlled). Without it, the shortcut toggles it.
onOpenChange((open: boolean) => void)-Called when it opens or closes.
placeholderstring'Type a command or search…'Shown in the search field. Default "Search or run a command…".

Accessibility

  • A dialog with a search field and a menu of results; arrow keys move without leaving the field.

Keyboard

KeyDoes
⌘K / Ctrl+KOpens or closes it
Arrow keysMove between results
EnterRuns the command
EscapeCloses

Do and don't

Do

  • Add keywords so people find commands by other words.

Don't

  • Don't make it the only way to reach something.
Tested with axe, keyboard and screen reader roles