Mark Yo

Command Palette

Navigation

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>
  );
}

Dependencies

More by Mark Yo

View all
  • Loader

    Loader

    64
  • Pricing Table

    Pricing Table

    23
  • Bento Grid

    Bento Grid

    1
  • Expandable Tabs

    Expandable Tabs

    1
  • Stateful Button

    Stateful Button

  • Animated Button

    Animated Button

  • Morphing Modal

    Morphing Modal

  • Morph Popover

    Morph Popover

More in Navigation

View all
  • Footer with Big Wordmark

    Footer with Big Wordmark

    81
  • Liquid Glass Expandable Sidebar

    Liquid Glass Expandable Sidebar

    255
  • Button Breadcrumb

    Button Breadcrumb

    36
  • Sidebar

    Sidebar

    414
  • Astryx Breadcrumb Item

    Astryx Breadcrumb Item

  • Menu

    Menu

    27
  • Progress Bar Stepper

    Progress Bar Stepper

    64
  • Pagination

    Pagination

    14