Dot Command
Opens with ⌘K (Ctrl+K elsewhere). Search runs each typed letter in order through every label and its keywords, best when they land on word starts or run together, so “cnp” finds Create new project and “theme” finds Toggle dark mode, and the matched letters are marked. The selection is a bar of dots with a lit edge that slides to each row on a spring. Arrow keys, Enter and Escape; a dialog, combobox and listbox to screen readers, and focus goes back where it was when it closes.
Needs: None. Canvas 2D.
Customize
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| items | CommandItem[] | required | What can be found: id, label, and optionally group, hint, keywords, shortcut, href and onSelect. |
| open | boolean | – | Open or closed. Leave unset and it keeps its own, opened with the hotkey. |
| onOpenChange | (open: boolean) => void | – | Called when it opens or closes. |
| onSelect | (item: CommandItem) => void | – | Called with whatever's chosen, after the item's own onSelect. |
| hotkey | string | false | "k" | The letter that opens it with ⌘ (Ctrl elsewhere). False for none. |
| placeholder | string | "Type a command or search…" | The search field's placeholder. |
| empty | string | "Nothing found" | What to say when nothing matches. |
| tone | string | – | The selection's colour. The page's accent by default. |
| className | string | – | Class on the overlay. |
| style | CSSProperties | – | Style on the overlay. |