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).
| Prop | Type | Default | Description |
|---|---|---|---|
commandsrequired | Command[] | - | The commands, in groups: id, label, icon, shortcut, keywords and onAction. |
emptyText | ReactNode | 'No results' | Shown when nothing matches. |
hotkey | boolean | true | Opens with ⌘K / Ctrl+K anywhere. Default true. |
isOpen | boolean | - | Whether it is open (controlled). Without it, the shortcut toggles it. |
onOpenChange | ((open: boolean) => void) | - | Called when it opens or closes. |
placeholder | string | '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
| Key | Does |
|---|---|
| ⌘K / Ctrl+K | Opens or closes it |
| Arrow keys | Move between results |
| Enter | Runs the command |
| Escape | Closes |
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.