Command Palette
Command Palette lets people search and run actions or jump to pages from the keyboard, in a modal search box. Author the commands; a small init() module filters and runs them.
Public web API
A native <dialog> holding a combobox input and a listbox of commands. Focus stays in the input; aria-activedescendant points at the active command.
- Open it with a button:
commandforandcommand="show-modal". Escape and focus return are native. - A link command is an
<a href role="option">; any other command fires acommandevent withdetail.value. - Add
data-bitsy-command-palette-shortcut="k"to bind Cmd or Ctrl plus K. Nothing is bound without it.
Variants and states
Open one, type "create" or "zzz", and use the arrow keys.
Bit boundary
- It is a shortcut, never the only way to reach a page or action. Use Combobox to pick a form value.
- Nested pages, recent commands, and async results are out of scope.