About
A Cmd/Ctrl+K launcher that fuzzy-searches app commands and pages, groups results with icons, hints and badges, and navigates with arrow keys and a springy highlight on the active row.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Command Palette to your project and fits it to your theme.
Code
How Command Palette is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client";
import {
CommandPalette,
type CommandItem,
} from "@/components/ui/command-palette";
import { FileText, Home, LogOut, Settings, User } from "lucide-react";
import { useState } from "react";
export default function CommandPaletteDemo() {
const [open, setOpen] = useState(true);
const items: CommandItem[] = [
{
id: "home",
label: "Go to Home",
group: "Navigation",
hint: "⌘H",
icon: Home,
onSelect: () => console.log("home"),
},
{
id: "profile",
label: "View Profile",
group: "Navigation",
icon: User,
onSelect: () => console.log("profile"),
},
{
id: "settings",
label: "Open Settings",
group: "Navigation",
icon: Settings,
hint: "⌘,",
onSelect: () => console.log("settings"),
},
{
id: "docs",
label: "Read Documentation",
group: "Help",
icon: FileText,
keywords: ["docs", "help", "guide"],
onSelect: () => console.log("docs"),
},
{
id: "logout",
label: "Log Out",
group: "Account",
icon: LogOut,
onSelect: () => console.log("logout"),
},
];
return (
<div className="relative h-[560px] w-full overflow-hidden bg-background">
<button
type="button"
onClick={() => setOpen(true)}
className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-md border border-border bg-card px-4 py-2 text-sm text-foreground"
>
Press ⌘K to open
</button>
<CommandPalette items={items} open={open} onOpenChange={setOpen} />
</div>
);
}
















