Skip to content
StackD
Command palette, the StackD component

Navigation · €7

Command palette

A ⌘K palette with fuzzy search, pages, shortcuts and light and dark themes.

Pay once on Gumroad: the download, plus a licence key for the registry and the MCP server.

Details

Category
Navigation
Plan
Paid, €7 once
Code
React + Tailwind, TypeScript · 605 lines
Files
CommandPalette.tsx
Needs
The Bot (installed with it)
Agents
MCP server and shadcn registry

About

The ⌘K menu. Press ⌘K (Ctrl+K on Windows) anywhere, type a few letters, hit Enter. The search forgives: the letters only have to come in order, so "nwprj" finds "New project", and the letters it matched light up. Commands sit in groups, the ones you ran last show on top, and shortcuts sit on the right. A command can open a page of its own (Theme → Light / Dark / System); Backspace or Esc goes back. The panel grows and shrinks smoothly with the results, and the selection slides from row to row.

The Bot (StackD Kit 01) is the search icon: it looks at what you type, then at the row you're on. It looks sad when nothing matches and smiles when a command runs.

As a pop-up over the page (the default) or inline in your layout. White and black versions. Keyboard first, and it works with screen readers. React + Tailwind, no other libraries. Respects reduced motion.

Install

Once: add the StackD registry to components.json, with the licence key from your receipt in STACKD_LICENSE_KEY (in .env.local):

"registries": {
  "@stackd": {
    "url": "https://www.stackd.codes/r/{name}.json",
    "headers": { "X-License-Key": "${STACKD_LICENSE_KEY}" }
  }
}

With the shadcn CLI:

npx shadcn@latest add @stackd/command-palette

Or let your agent add it through the StackD MCP server:

claude mcp add --transport http stackd https://www.stackd.codes/mcp

Prompt for your agent

Paste it into Claude Code, Cursor, Codex or VS Code once the MCP server is connected.

Add the StackD Command palette component to this project. Use the StackD MCP server: call get_component with { "name": "command-palette" }, write the files at the paths it gives and install any npm packages it lists. Then use it where it fits, following its README for the props, and keep its own styles. It is a paid component: if the server says it needs a licence, tell me where to buy it.

Use

  1. Copy CommandPalette.tsx and Bot.tsx into the same folder of your project (for example components/).

If you already have the Bot from an earlier StackD component, replace it with this one.

  1. Describe your commands and drop the palette anywhere in your app (once is enough):
import { CommandPalette, type CommandItem } from './components/CommandPalette'

const commands: CommandItem[] = [
  { id: 'new', label: 'New project', group: 'Create', shortcut: ['⌘', 'N'], onSelect: () => createProject() },
  { id: 'inbox', label: 'Go to inbox', group: 'Navigate', onSelect: () => router.push('/inbox') },
  { id: 'billing', label: 'Billing', group: 'Navigate', keywords: ['invoice', 'plan'], onSelect: () => router.push('/billing') },
  {
    id: 'theme', label: 'Change theme', group: 'Settings', keywords: ['dark', 'light'],
    children: [
      { id: 'light', label: 'Light', onSelect: () => setTheme('light') },
      { id: 'dark', label: 'Dark', onSelect: () => setTheme('dark') },
    ],
  },
]

<CommandPalette items={commands} />

Now ⌘K opens it. Each item can carry an icon (any React node, 18 px works best) and a hint (a quiet note after the label, like "3 new").

Open it from your own button too:

const [open, setOpen] = useState(false)

<button onClick={() => setOpen(true)}>Search ⌘K</button>
<CommandPalette items={commands} open={open} onOpenChange={setOpen} />

Inline, always open (a help page, a sidebar):

<CommandPalette items={commands} modal={false} hotkey={false} theme="dark" />

In Next.js the files already start with 'use client'. In other React setups that line does nothing.

Options

PropDefaultWhat it does
itemsYour commands, see below
open / onOpenChangeControl it yourself. Leave them out and ⌘K opens and closes it
defaultOpenfalseStart open
onSelect(item) => void, called for every command that runs (after the item's own onSelect)
modaltruetrue: a pop-up over the page. false: a panel in your layout, always open
hotkey'k'The key that goes with ⌘ / Ctrl. false turns the shortcut off
theme'light''light' (white) or 'dark' (black)
colorWineThe colour of the matched letters
botcircle, tall eyes{ shape, eyes } for the Bot, from Kit 01
placeholder'Search or jump to…'The search box's text
recents3How many recent commands to show on top. 0 hides them
defaultQueryStart with something already typed

Each item (CommandItem):

FieldWhat it does
id, labelRequired
groupThe heading it's listed under
iconAny React node
keywordsOther words that should find it
shortcutKeys shown on the right, like ['⌘', 'N'] (display only)
hintA quiet note after the label
onSelectWhat it does
childrenMakes it a page: picking it opens these items
placeholderThe search box's text on that page

Keyboard

⌘K / Ctrl+K: open and close. Up / Down: move (it wraps). Home / End: first / last. Enter: run, or open a page. Esc: clear the search, then go back, then close. Backspace in an empty search: go back.

Colours from StackD

White #FFFFFF · Ink #141310 · Wine #901919 · Olive #6C8544 · Ochre #BE9344 · Lilac #C9B8FF

Licence

You can use it in personal and commercial projects. Don't resell or share the component on its own.

Made by StackD · stackd.codes