CommandPalette
A ⌘K-style command palette with fuzzy search over grouped actions, fully keyboard-navigable. It opens with ⌘/Ctrl + K or from a button.
Overlays · TaishoDS Core, in plain HTML.
Examples
One working example per case. Each example is the HTML of its preview—copy it as is, and with Core’s CSS and JS loaded, it looks and works the same.
Command palette with ⌘K shortcut
Palette with no commands
No commands here. Press ⌘ J.
When to use
- The app has many actions and destinations, and you want fast, searchable access to all of them.
- Your audience uses the keyboard and values getting anywhere without the mouse.
- You want one place to navigate and run actions instead of hunting for buttons.
When not to use
- It’s a few actions on a specific trigger →
menu. - You’re capturing a form value, not running commands →
combobox. - The actions apply to an element and open with a right-click →
context-menu.
Do
- Group the commands and write good labels. That’s what gets filtered.
- Also offer a visible path (a ⌘K button) so people can discover it.
Don’t
- Don’t make it the only way in. Not everyone knows ⌘K exists.
- Don’t put destructive commands behind a quick match without a confirmation.
TaishoDS Core
Needs Core’s JS, which handles focus, keyboard, and state.
It combines a global keyboard shortcut, filtering, and focus.
Core hooks into it through these attributes. They go in the markup, and there’s nothing to initialize.
data-ts-command-dialogdata-ts-command-opendata-ts-command-palettedata-ts-empty-fordata-ts-field-spinnerdata-ts-inputdata-ts-keywordsdata-ts-listboxdata-ts-listbox-emptydata-ts-listbox-inputdata-ts-listbox-paneldata-ts-shortcutdata-ts-value
What it does: A global keyboard shortcut, filtering, and list navigation. Home and End move the caret in the input. It’s built on a modal <dialog>, so a single Esc press closes it. The “no results” text comes from a template in data-ts-empty-for.
From the CDN, without a build, load taisho.command-palette.css along with taisho.base.css. Also load:
taisho.button.csstaisho.icon.csstaisho.input.csstaisho.kbd.csstaisho.loading-dots.csstaisho.spinner.css
For how Core works in general, see Behavior.
Accessibility
Implements the Combobox pattern from the WAI-ARIA APG.
- Focus moves to the search field automatically on open. ↑/↓ move the selection, Enter runs, and a single Esc press closes it (in Core, the native
<dialog>handles that). - The input is a
role="combobox"witharia-autocomplete="list",aria-expanded, andaria-controlspointing to the listbox, andaria-activedescendantpoints to the highlighted option. The screen reader announces it without moving focus out of the input. - The options aren’t tabbable, and focus is virtual. Pressing them with the mouse doesn’t take focus away from the input. Home and End move the text caret, not the highlighted option. On close (Esc, selecting, or clicking outside), focus returns to whatever had it when the palette opened.
- The global shortcut is set with
data-ts-shortcut(by default,kwith Ctrl or ⌘).
Keyboard
On top of what the browser already does (Tab moves focus, Enter activates a button).
| Key | What it does |
|---|---|
| ↑↓ | Move through the results. |
| Enter | Runs the highlighted command. |
| Esc | Closes the palette. |
Verification
What was actually tested. Anything that wasn’t tested says so—we’d rather say “not verified” than claim too much.
- axe WCAG 2.2 A + AA in a real browser, in light and dark mode, before every release.
- keyboard Key map documented above, checked against the component.
- screen reader Not verified with a screen reader. Test it in your own combination of components, not just here, where each one appears alone and on its happy path.