{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "command", "title": "Command", "description": "A keyboard-first filtered command list.", "dependencies": [ "lucide-react@^1.28.0" ], "registryDependencies": [ "@manner/utils", "@manner/manner-theme" ], "files": [ { "path": "registry/manner/ui/command.tsx", "content": "\"use client\"\n\nimport { Search } from \"lucide-react\"\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/cn\"\n\ntype CommandItem = { id: string; label: string; description?: string; keywords?: string[] }\n\ntype CommandProps = {\n items: CommandItem[]\n onSelect?: (item: CommandItem) => void\n placeholder?: string\n emptyText?: string\n className?: string\n}\n\nfunction Command({ items, onSelect, placeholder = \"Type a command…\", emptyText = \"No commands found.\", className }: CommandProps) {\n const [query, setQuery] = React.useState(\"\")\n const [activeIndex, setActiveIndex] = React.useState(0)\n const filtered = React.useMemo(() => {\n const value = query.trim().toLowerCase()\n if (!value) return items\n return items.filter((item) => [item.label, item.description, ...(item.keywords ?? [])].filter(Boolean).join(\" \").toLowerCase().includes(value))\n }, [items, query])\n\n function select(item: CommandItem | undefined) {\n if (item) onSelect?.(item)\n }\n\n return (\n
{emptyText}
}\n