{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "cosmic-button", "type": "registry:ui", "description": "Animated button/link with cosmic gradient border effect, renders as anchor or button", "files": [ { "path": "registry/default/ui/cosmic-button.tsx", "content": "\"use client\"\n\nimport type { ComponentPropsWithoutRef } from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n/**\n * Requires these keyframes and utilities in your CSS (e.g. global CSS or Tailwind):\n *\n * @keyframes cosmic-spin {\n * from { transform: rotate(0deg); }\n * to { transform: rotate(360deg); }\n * }\n * @keyframes cosmic-spin-slow {\n * from { transform: rotate(0deg); }\n * to { transform: rotate(-360deg); }\n * }\n * @utility animate-cosmic-spin {\n * animation: cosmic-spin 3s linear infinite;\n * }\n * @utility animate-cosmic-spin-slow {\n * animation: cosmic-spin-slow 5s linear infinite;\n * }\n */\n\nexport type CosmicButtonProps = {\n /** The HTML element to render as. @default \"a\" */\n as?: E\n} & ComponentPropsWithoutRef\n\n/**\n * An animated button/link with a cosmic gradient border effect.\n * Renders as an anchor by default; use `as=\"button\"` for button behavior.\n *\n * @example\n * // As link (default)\n * About\n *\n * @example\n * // As button\n * Submit\n */\nexport function CosmicButton({\n as,\n className,\n children,\n ...props\n}: CosmicButtonProps) {\n const Element = as ?? \"a\"\n const isAnchor = Element === \"a\"\n\n const baseClassName = cn(\n \"group/cosmic relative inline-flex min-h-11 min-w-11 items-center justify-center gap-3 rounded-[15px] p-[3px] transition-transform \",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#adfa1b] focus-visible:ring-offset-2 focus-visible:ring-offset-white dark:focus-visible:ring-offset-[#0c0912]\",\n className\n )\n\n const content = (\n <>\n {/* Animated cosmic border - enlarges on hover */}\n \n \n \n\n {/* Noise/texture overlay on the border - enlarges on hover */}\n \n \n \n\n {/* Theme-aware inner background */}\n \n \n {children ?? \"Placeholder text\"}\n \n \n \n )\n\n if (isAnchor) {\n const { href, rel, target, ...rest } =\n props as ComponentPropsWithoutRef<\"a\">\n return (\n \n {content}\n \n )\n }\n\n return (\n )}\n >\n {content}\n \n )\n}\n", "type": "registry:ui" } ] }