Command palette · ⌘K
A ⌘K launcher with fuzzy ranking and marked matches, groups, pages of their own, recent commands, live results from a server and shortcuts that work with it closed.
or press ⌘ K / Ctrl K anywhere on the site
Fuzzy searchtype
tgdk — “Toggle light / dark” is found, the matched letters markedPages“Change theme…” and “Go to page…” open a list of their own · ⌫ or Esc goes back
Live resultstype a name or a city (“Ada”, “Tokyo”) — people come from a (pretend) server under the commands
Shortcuts⌘ ⇧ L toggles the theme and ⌘ ⇧ C copies the link — without opening the palette
Recentwhat you ran last comes first next time (kept in this browser)
Usage
import { signal } from "./index.js";import { CommandPalette } from "./components/command.js"; const open = signal(false); // also opens on ⌘K / Ctrl K automatically const commands = [ { group: "Actions", label: "Toggle light / dark", icon: "🌓", keywords: "dark mode", shortcut: "mod+shift+l", onRun: toggleMode }, // the shortcut works with the palette closed { group: "Preferences", label: "Change theme…", icon: "🎨", children: () => themes.map((t) => ({ label: t.label, onRun: () => theme.set(t.id) })) }, { label: "Export as PDF", description: "Coming soon", disabled: true },]; // mount once. Fuzzy ranking, groups, pages, recent commands, live results:CommandPalette({ open, commands, search: async (q) => (await api.people(q)).map((p) => ({ label: p.name, onRun: () => show(p) })) })