{ "name": "particle-button", "type": "registry:component", "dependencies": [ "lucide-react", "motion" ], "registryDependencies": [ "button" ], "files": [ { "type": "registry:component", "content": "\"use client\";\n\n/**\n * @author: @dorianbaffier\n * @description: Particle Button\n * @version: 1.0.0\n * @date: 2025-06-26\n * @license: MIT\n * @website: https://kokonutui.com\n * @github: https://github.com/kokonut-labs/kokonutui\n */\n\nimport { MousePointerClick } from \"lucide-react\";\nimport { AnimatePresence, motion } from \"motion/react\";\nimport { type RefObject, useRef, useState } from \"react\";\nimport type { ButtonProps } from \"@/components/ui/button\";\nimport { Button } from \"@/components/ui/button\";\nimport { cn } from \"@/lib/utils\";\n\ninterface ParticleButtonProps extends ButtonProps {\n onSuccess?: () => void;\n successDuration?: number;\n}\n\nfunction SuccessParticles({\n buttonRef,\n}: {\n buttonRef: React.RefObject;\n}) {\n const rect = buttonRef.current?.getBoundingClientRect();\n if (!rect) return null;\n\n const centerX = rect.left + rect.width / 2;\n const centerY = rect.top + rect.height / 2;\n\n return (\n \n {[...Array(6)].map((_, i) => (\n \n ))}\n \n );\n}\n\nexport default function ParticleButton({\n children,\n onClick,\n onSuccess,\n successDuration = 1000,\n className,\n ...props\n}: ParticleButtonProps) {\n const [showParticles, setShowParticles] = useState(false);\n const buttonRef = useRef(null);\n\n const handleClick = async (e: React.MouseEvent) => {\n setShowParticles(true);\n\n setTimeout(() => {\n setShowParticles(false);\n }, successDuration);\n };\n\n return (\n <>\n {showParticles && (\n }\n />\n )}\n \n {children}\n \n \n \n );\n}\n", "path": "/components/kokonutui/particle-button.tsx", "target": "components/kokonutui/particle-button.tsx" } ] }