{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "command-palette",
  "title": "Command Palette",
  "description": "A reusable command dialog wrapper for grouped actions, app navigation, and searchable command menus.",
  "dependencies": [
    "lucide-react",
    "motion"
  ],
  "registryDependencies": [
    "button",
    "command"
  ],
  "files": [
    {
      "path": "registry/corr/components/command-palette.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { SearchIcon } from \"lucide-react\"\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\"\n\nimport { Button } from \"@/components/ui/button\"\nimport {\n  Command,\n  CommandDialog,\n  CommandEmpty,\n  CommandGroup,\n  CommandInput,\n  CommandItem,\n  CommandList,\n} from \"@/components/ui/command\"\n\nexport type CommandPaletteItem = {\n  id: string\n  label: string\n  description?: string\n  icon?: React.ReactNode\n  keywords?: string[]\n  onSelect?: () => void\n}\n\nexport type CommandPaletteGroup = {\n  id: string\n  label: string\n  items: CommandPaletteItem[]\n}\n\nexport function CommandPalette({\n  open,\n  onOpenChange,\n  groups,\n  placeholder = \"Type a command or search...\",\n  emptyLabel = \"No results found.\",\n  trigger,\n}: {\n  open?: boolean\n  onOpenChange?: (open: boolean) => void\n  groups: CommandPaletteGroup[]\n  placeholder?: string\n  emptyLabel?: string\n  trigger?: React.ReactNode\n}) {\n  const [internalOpen, setInternalOpen] = React.useState(false)\n  const isControlled = typeof open === \"boolean\"\n  const currentOpen = isControlled ? open : internalOpen\n  const reduceMotion = useReducedMotion()\n\n  function setOpen(nextOpen: boolean) {\n    if (!isControlled) setInternalOpen(nextOpen)\n    onOpenChange?.(nextOpen)\n  }\n\n  return (\n    <>\n      {trigger ? (\n        <span onClick={() => setOpen(true)}>{trigger}</span>\n      ) : (\n        <Button type=\"button\" variant=\"outline\" onClick={() => setOpen(true)}>\n          <SearchIcon className=\"size-4\" />\n          Open command palette\n        </Button>\n      )}\n      <CommandDialog open={currentOpen} onOpenChange={setOpen}>\n        <Command>\n          <CommandInput placeholder={placeholder} />\n          <CommandList>\n            <CommandEmpty>{emptyLabel}</CommandEmpty>\n            {groups.map((group) => (\n              <CommandGroup key={group.id} heading={group.label}>\n                <AnimatePresence initial={false}>\n                  {group.items.map((item, index) => (\n                    <motion.div\n                      key={item.id}\n                      initial={{\n                        opacity: 0,\n                        y: reduceMotion ? 0 : 4,\n                      }}\n                      animate={{ opacity: 1, y: 0 }}\n                      exit={{ opacity: 0 }}\n                      transition={{\n                        duration: reduceMotion ? 0 : 0.14,\n                        delay: reduceMotion ? 0 : index * 0.015,\n                      }}\n                    >\n                      <CommandItem\n                        value={[\n                          item.label,\n                          item.description,\n                          ...(item.keywords ?? []),\n                        ]\n                          .filter(Boolean)\n                          .join(\" \")}\n                        onSelect={() => {\n                          item.onSelect?.()\n                          setOpen(false)\n                        }}\n                      >\n                        {item.icon}\n                        <span className=\"min-w-0\">\n                          <span className=\"block truncate\">{item.label}</span>\n                          {item.description ? (\n                            <span className=\"block truncate text-xs text-muted-foreground\">\n                              {item.description}\n                            </span>\n                          ) : null}\n                        </span>\n                      </CommandItem>\n                    </motion.div>\n                  ))}\n                </AnimatePresence>\n              </CommandGroup>\n            ))}\n          </CommandList>\n        </Command>\n      </CommandDialog>\n    </>\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}