A searchable command menu with a Page filter, keyboard navigation, shortcuts, and a sliding selection highlight. Choose All pages to search every command, or select a page category to filter the results. Search matches labels, categories, and keywords. Disabled commands remain visible and are skipped by keyboard navigation.

Click the ⌘ K button in the demo, or press ⌘ K / Ctrl K, to open the palette. Escape clears the search first, then closes the palette. A click outside or selecting a command also closes it and returns focus to the button.

Installation

Add the command component from Hangry UI to this project.
Use the project's package manager to run:
shadcn@latest add https://ui.razeev.com/r/command.json
Integrate the component with the existing layout and styling.
Keep its interactions and reduced-motion support intact.

How to use

Use a client component when handling selections. Give each item a unique, stable id.

"use client";
import { Command } from "@/components/hangry-ui/components/command";
export default function CommandMenu() {
return (
<Command
items={[
{ id: "home", label: "Go home", group: "Navigation", keywords: ["dashboard"] },
{ id: "settings", label: "Settings", group: "Account", shortcut: "⌘ ," },
]}
onSelect={(item) => console.log(item.id)}
/>
);
}

Focus the search field, use ↑ and ↓ to move between enabled results, then press Enter to select. Escape clears the search. Shortcut labels are visual hints; bind application shortcuts in your own code. This is an inline menu and does not register a global keyboard shortcut or open a dialog.

Props

PropTypeDefaultDescription
itemsreadonly CommandItem[]Example commands

Actions with unique IDs, labels, optional groups, keywords, shortcuts, and disabled states.

onSelect(item: CommandItem) => void—Called when an enabled command is selected with Enter or a click.
placeholderstringType a command or search…Search field placeholder.
labelstringSearch commandsAccessible label for the search field.
emptyMessagestringNo commands found.Message displayed when the search has no results.
classNamestring—Additional classes for the menu container.

Dependencies

  • lucide-react
  • Motion