{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "command-palette-shadcnui", "type": "registry:component", "title": "Command Palette", "description": "Command palette with search and keyboard navigation", "registryDependencies": [ "button" ], "dependencies": [ "framer-motion", "react" ], "files": [ { "path": "@uitripled/react-shadcn/src/components/search/command-palette.tsx", "content": "\"use client\";\n\nimport {\n AnimatePresence,\n motion,\n useReducedMotion,\n type Transition,\n type Variants,\n} from \"framer-motion\";\nimport { File, Search, Settings, User, X } from \"lucide-react\";\nimport { useMemo, useState } from \"react\";\n\ntype Command = {\n icon: typeof File;\n label: string;\n shortcut: string;\n description: string;\n};\n\nconst commands: Command[] = [\n {\n icon: File,\n label: \"New File\",\n shortcut: \"⌘N\",\n description: \"Spin up a glassmorphic canvas\",\n },\n {\n icon: Settings,\n label: \"Workspace Settings\",\n shortcut: \"⌘,\",\n description: \"Fine-tune tokens, motion, and themes\",\n },\n {\n icon: User,\n label: \"Team Directory\",\n shortcut: \"⌘P\",\n description: \"Invite collaborators to your motion library\",\n },\n {\n icon: Search,\n label: \"Global Command\",\n shortcut: \"⌘K\",\n description: \"Jump anywhere with palette search\",\n },\n];\n\nconst overlayTransition: Transition = { duration: 0.24, ease: \"easeOut\" };\n\nexport function CommandPalette() {\n const [isOpen, setIsOpen] = useState(false);\n const [query, setQuery] = useState(\"\");\n const shouldReduceMotion = useReducedMotion();\n\n const filteredCommands = useMemo(\n () =>\n commands.filter((cmd) =>\n cmd.label.toLowerCase().includes(query.toLowerCase())\n ),\n [query]\n );\n\n const panelVariants: Variants = shouldReduceMotion\n ? {\n initial: { opacity: 0, y: 0, scale: 1 },\n animate: { opacity: 1, y: 0, scale: 1 },\n exit: { opacity: 0, y: 0, scale: 1 },\n }\n : {\n initial: { opacity: 0, scale: 0.96, y: 20, filter: \"blur(6px)\" },\n animate: {\n opacity: 1,\n scale: 1,\n y: 0,\n filter: \"blur(0px)\",\n transition: { duration: 0.28, ease: [0.18, 0.89, 0.32, 1.12] },\n },\n exit: {\n opacity: 0,\n scale: 0.97,\n y: 12,\n filter: \"blur(8px)\",\n transition: { duration: 0.2, ease: [0.4, 0, 0.2, 1] },\n },\n };\n\n return (\n
\n setIsOpen(true)}\n className=\"group flex items-center gap-3 rounded-full border border-border/60 bg-card/80 px-4 py-2.5 text-sm text-[var(--muted-foreground)] shadow-[0_12px_30px_-15px_rgba(15,23,42,0.6)] backdrop-blur-lg transition-shadow duration-300 hover:shadow-[0_18px_45px_-20px_rgba(15,23,42,0.7)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background\"\n whileHover={shouldReduceMotion ? undefined : { scale: 1.02 }}\n whileTap={shouldReduceMotion ? undefined : { scale: 0.98 }}\n >\n \n Search commands…\n \n ⌘K\n \n \n\n \n {isOpen && (\n <>\n setIsOpen(false)}\n />\n\n
\n event.stopPropagation()}\n >\n \n \n \n
\n\n
\n \n setQuery(event.target.value)}\n placeholder=\"Search the glassmorphism toolkit…\"\n className=\"flex-1 bg-transparent text-sm text-[var(--muted-foreground)] outline-none placeholder:text-[var(--muted-foreground)]\"\n autoFocus\n />\n setIsOpen(false)}\n className=\"inline-flex h-9 w-9 items-center justify-center rounded-full border border-border/60 bg-white/5 text-[var(--muted-foreground)] transition-colors hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary\"\n whileHover={\n shouldReduceMotion\n ? undefined\n : { rotate: 90, scale: 1.05 }\n }\n whileTap={shouldReduceMotion ? undefined : { scale: 0.9 }}\n >\n \n Close command palette\n \n
\n\n \n {filteredCommands.length === 0 ? (\n
\n No commands found. Try a different search term.\n
\n ) : (\n
    \n {filteredCommands.map((cmd, index) => {\n const Icon = cmd.icon;\n return (\n \n \n
    \n \n \n \n
    \n \n {cmd.label}\n \n \n {cmd.description}\n \n
    \n
    \n \n {cmd.shortcut}\n \n \n \n );\n })}\n
\n )}\n \n \n
\n \n )}\n \n \n );\n}\n", "type": "registry:component", "target": "components/uitripled/command-palette-shadcnui.tsx" } ] }