{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "icon-button", "type": "registry:ui", "title": "Icon Button", "description": "An icon button that displays particles when clicked.", "dependencies": [ "motion" ], "files": [ { "path": "registry/buttons/icon/index.tsx", "content": "'use client';\n\nimport * as React from 'react';\nimport {\n motion,\n AnimatePresence,\n type HTMLMotionProps,\n type Transition,\n} from 'motion/react';\n\nimport { cn } from '@/lib/utils';\n\nconst sizes = {\n default: 'size-8 [&_svg]:size-5',\n sm: 'size-6 [&_svg]:size-4',\n md: 'size-10 [&_svg]:size-6',\n lg: 'size-12 [&_svg]:size-7',\n};\n\ntype IconButtonProps = Omit, 'color'> & {\n icon: React.ElementType;\n active?: boolean;\n className?: string;\n animate?: boolean;\n size?: keyof typeof sizes;\n color?: [number, number, number];\n transition?: Transition;\n};\n\nfunction IconButton({\n icon: Icon,\n className,\n active = false,\n animate = true,\n size = 'default',\n color = [59, 130, 246],\n transition = { type: 'spring', stiffness: 300, damping: 15 },\n ...props\n}: IconButtonProps) {\n return (\n \n \n \n \n\n \n {active && (\n \n \n \n )}\n \n\n \n {animate && active && (\n <>\n \n \n {[...Array(6)].map((_, i) => (\n \n ))}\n \n )}\n \n \n );\n}\n\nexport { IconButton, sizes, type IconButtonProps };\n", "type": "registry:ui", "target": "components/animate-ui/buttons/icon.tsx" } ] }