{ "name": "prompt-suggestion", "type": "registry:ui", "registryDependencies": [ "button" ], "dependencies": [ "class-variance-authority", "lucide-react" ], "devDependencies": [], "tailwind": {}, "cssVars": { "light": {}, "dark": {} }, "description": "A component for implementing interactive prompt suggestions in AI interfaces. The PromptSuggestion component offers two distinct modes: Normal Mode and Highlight Mode.", "files": [ { "path": "prompt-suggestion.tsx", "content": "\"use client\"\n\nimport { Button, buttonVariants } from \"@/components/ui/button\"\nimport { cn } from \"@/lib/utils\"\nimport { VariantProps } from \"class-variance-authority\"\n\nexport type PromptSuggestionProps = {\n children: React.ReactNode\n variant?: VariantProps[\"variant\"]\n size?: VariantProps[\"size\"]\n className?: string\n highlight?: string\n} & React.ButtonHTMLAttributes\n\nfunction PromptSuggestion({\n children,\n variant,\n size,\n className,\n highlight,\n ...props\n}: PromptSuggestionProps) {\n const isHighlightMode = highlight !== undefined && highlight.trim() !== \"\"\n const content = typeof children === \"string\" ? children : \"\"\n\n if (!isHighlightMode) {\n return (\n \n {children}\n \n )\n }\n\n if (!content) {\n return (\n \n {children}\n \n )\n }\n\n const trimmedHighlight = highlight.trim()\n const contentLower = content.toLowerCase()\n const highlightLower = trimmedHighlight.toLowerCase()\n const shouldHighlight = contentLower.includes(highlightLower)\n\n return (\n \n {shouldHighlight ? (\n (() => {\n const index = contentLower.indexOf(highlightLower)\n if (index === -1)\n return (\n \n {content}\n \n )\n\n const actualHighlightedText = content.substring(\n index,\n index + highlightLower.length\n )\n\n const before = content.substring(0, index)\n const after = content.substring(index + actualHighlightedText.length)\n\n return (\n <>\n {before && (\n \n {before}\n \n )}\n \n {actualHighlightedText}\n \n {after && (\n \n {after}\n \n )}\n \n )\n })()\n ) : (\n \n {content}\n \n )}\n \n )\n}\n\nexport { PromptSuggestion }\n", "type": "registry:ui" } ] }