{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "glossy-gradient-button",
  "title": "Glossy Gradient Button",
  "description": "A premium call-to-action button with a glossy face: a lit gradient, a glass highlight on the top half, a band of light that sweeps across on hover, an arrow that nudges forward, and a press that sinks. Ink, paper and four colour palettes, or your own two stops.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/glossy-gradient-button/glossy-gradient-button.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { motion, AnimatePresence, useReducedMotion } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport type GlossyPalette = \"ink\" | \"paper\" | \"aurora\" | \"sunset\" | \"ocean\" | \"ember\";\nexport type GlossySize = \"sm\" | \"md\" | \"lg\";\n\nexport interface GlossyGradientButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"onDrag\" | \"onDragStart\" | \"onDragEnd\" | \"onAnimationStart\"> {\n  /** ink: glossy black. paper: glossy white. The rest are colour gradients. */\n  palette?: GlossyPalette;\n  /** Your own gradient stops, overriding the palette: [top, bottom]. */\n  colors?: [string, string];\n  size?: GlossySize;\n  /** Icon before the label. */\n  icon?: React.ReactNode;\n  /** Show an arrow after the label that nudges forward on hover. */\n  arrow?: boolean;\n  loading?: boolean;\n  /** Run the light sweep once on hover. */\n  sweep?: boolean;\n  fullWidth?: boolean;\n  ref?: React.Ref<HTMLButtonElement>;\n}\n\n// [top, bottom, text, ring] per palette. The top stop is lighter so the face reads as lit from above.\nconst PALETTES: Record<GlossyPalette, [string, string, string, string]> = {\n  ink: [\"#3A3A3C\", \"#0B0B0C\", \"#FFFFFF\", \"rgba(255,255,255,0.14)\"],\n  paper: [\"#FFFFFF\", \"#E4E3DF\", \"#0A0A0A\", \"rgba(10,10,10,0.12)\"],\n  aurora: [\"#8B7CFF\", \"#4B3BDB\", \"#FFFFFF\", \"rgba(255,255,255,0.22)\"],\n  sunset: [\"#FFB25B\", \"#F0572B\", \"#FFFFFF\", \"rgba(255,255,255,0.25)\"],\n  ocean: [\"#4FC3F7\", \"#1565C0\", \"#FFFFFF\", \"rgba(255,255,255,0.22)\"],\n  ember: [\"#FF6B6B\", \"#B3122E\", \"#FFFFFF\", \"rgba(255,255,255,0.22)\"],\n};\n\nconst SIZES: Record<GlossySize, { h: number; px: number; font: number; radius: number; icon: number; gap: number }> = {\n  sm: { h: 34, px: 14, font: 13, radius: 10, icon: 15, gap: 7 },\n  md: { h: 42, px: 18, font: 14.5, radius: 12, icon: 17, gap: 8 },\n  lg: { h: 52, px: 24, font: 16, radius: 15, icon: 19, gap: 10 },\n};\n\nexport function GlossyGradientButton({ palette = \"ink\", colors, size = \"md\", icon, arrow = false, loading = false, sweep = true, fullWidth = false, children, className, style, disabled, ref, ...rest }: GlossyGradientButtonProps) {\n  const [top, bottom, text, ring] = PALETTES[palette];\n  const from = colors?.[0] ?? top;\n  const to = colors?.[1] ?? bottom;\n  const s = SIZES[size];\n  const reduce = Boolean(useReducedMotion());\n  const off = disabled || loading;\n  const light = palette === \"paper\";\n\n  return (\n    <motion.button\n      ref={ref}\n      type=\"button\"\n      disabled={off}\n      aria-busy={loading || undefined}\n      initial=\"rest\"\n      animate=\"rest\"\n      whileHover={off ? undefined : \"hover\"}\n      whileTap={off ? undefined : \"press\"}\n      variants={{ rest: { y: 0, scale: 1 }, hover: { y: reduce ? 0 : -1, scale: 1 }, press: { y: reduce ? 0 : 1, scale: reduce ? 1 : 0.985 } }}\n      transition={{ type: \"spring\", stiffness: 520, damping: 30 }}\n      className={cn(\"relative isolate inline-flex cursor-pointer items-center justify-center overflow-hidden font-semibold whitespace-nowrap outline-none select-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-55\", fullWidth && \"w-full\", className)}\n      style={{\n        height: s.h,\n        padding: `0 ${s.px}px`,\n        gap: s.gap,\n        borderRadius: s.radius,\n        fontSize: s.font,\n        fontFamily: \"Inter, sans-serif\",\n        color: text,\n        backgroundImage: `linear-gradient(180deg, ${from}, ${to})`,\n        // Outer ring, a soft drop, and an inner top highlight + bottom shade for the glossy face.\n        boxShadow: `0 0 0 1px ${light ? \"rgba(10,10,10,0.14)\" : \"rgba(0,0,0,0.55)\"}, 0 1px 2px rgba(0,0,0,0.25), 0 6px 16px -6px color-mix(in srgb, ${to} 70%, transparent), inset 0 1px 0 ${ring}, inset 0 -1px 0 rgba(0,0,0,0.18)`,\n        [\"--tw-ring-color\" as string]: light ? \"rgba(10,10,10,0.85)\" : \"rgba(245,244,241,0.85)\",\n        [\"--tw-ring-offset-color\" as string]: \"transparent\",\n        ...style,\n      }}\n      {...rest}\n    >\n      {/* Glass: the upper half catches the light. */}\n      <span aria-hidden=\"true\" className=\"pointer-events-none absolute inset-x-0 top-0 -z-10 h-1/2\" style={{ background: `linear-gradient(180deg, rgba(255,255,255,${light ? 0.7 : 0.16}), rgba(255,255,255,0))` }} />\n      {/* A band of light that sweeps across on hover. */}\n      {sweep && !reduce && (\n        <motion.span\n          aria-hidden=\"true\"\n          className=\"pointer-events-none absolute inset-y-0 -z-10\"\n          style={{ width: \"45%\", background: `linear-gradient(100deg, transparent, rgba(255,255,255,${light ? 0.9 : 0.28}), transparent)` }}\n          variants={{ rest: { left: \"-60%\", transition: { duration: 0 } }, hover: { left: \"120%\", transition: { duration: 0.75, ease: [0.4, 0, 0.2, 1] } }, press: { left: \"120%\" } }}\n        />\n      )}\n      <AnimatePresence initial={false} mode=\"popLayout\">\n        {loading ? (\n          <motion.svg key=\"spin\" width={s.icon} height={s.icon} viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\" initial={{ opacity: 0, scale: 0.6 }} animate={{ opacity: 1, scale: 1, rotate: reduce ? 0 : 360 }} exit={{ opacity: 0, scale: 0.6 }} transition={{ rotate: { duration: 0.8, repeat: Infinity, ease: \"linear\" }, default: { duration: 0.15 } }}>\n            <circle cx=\"12\" cy=\"12\" r=\"9\" stroke=\"currentColor\" strokeOpacity=\"0.3\" strokeWidth=\"2.5\" />\n            <path d=\"M21 12a9 9 0 0 0-9-9\" stroke=\"currentColor\" strokeWidth=\"2.5\" strokeLinecap=\"round\" />\n          </motion.svg>\n        ) : icon ? (\n          <motion.span key=\"icon\" className=\"flex [&>svg]:h-full [&>svg]:w-full\" style={{ width: s.icon, height: s.icon }} initial={{ opacity: 0, scale: 0.6 }} animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0, scale: 0.6 }}>\n            {icon}\n          </motion.span>\n        ) : null}\n      </AnimatePresence>\n      <span style={{ textShadow: light ? \"none\" : \"0 1px 0 rgba(0,0,0,0.25)\" }}>{children}</span>\n      {arrow && (\n        <motion.svg width={s.icon - 2} height={s.icon - 2} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\" variants={{ rest: { x: 0 }, hover: { x: reduce ? 0 : 3 }, press: { x: reduce ? 0 : 1 } }}>\n          <path d=\"M5 12h14M13 6l6 6-6 6\" />\n        </motion.svg>\n      )}\n    </motion.button>\n  );\n}\n\nconst sparkle = (\n  <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n    <path d=\"M12 2.5c.6 4.5 2.4 6.3 6.9 6.9-4.5.6-6.3 2.4-6.9 6.9-.6-4.5-2.4-6.3-6.9-6.9 4.5-.6 6.3-2.4 6.9-6.9Z\" />\n  </svg>\n);\nconst rocket = (\n  <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n    <path d=\"M12 15.5 8.5 12c1.8-5 5.3-8 11-8.5-.5 5.7-3.5 9.2-8.5 11ZM8.5 12H5l2-3.5h4M12 15.5V19l3.5-2v-4\" />\n  </svg>\n);\n\nexport function GlossyGradientButtonDemo({ theme = \"dark\" }: { theme?: \"dark\" | \"light\" }) {\n  const [deploying, setDeploying] = React.useState(false);\n  return (\n    <div className=\"flex flex-col items-center\" style={{ gap: 20 }}>\n      <div className=\"flex flex-wrap items-center justify-center\" style={{ gap: 12 }}>\n        <GlossyGradientButton palette={theme === \"dark\" ? \"paper\" : \"ink\"} arrow>\n          Get started\n        </GlossyGradientButton>\n        <GlossyGradientButton palette=\"aurora\" icon={sparkle}>\n          Upgrade to Pro\n        </GlossyGradientButton>\n      </div>\n      <div className=\"flex flex-wrap items-center justify-center\" style={{ gap: 12 }}>\n        <GlossyGradientButton\n          palette={theme === \"dark\" ? \"ink\" : \"paper\"}\n          icon={rocket}\n          loading={deploying}\n          onClick={() => {\n            setDeploying(true);\n            setTimeout(() => setDeploying(false), 1600);\n          }}\n        >\n          {deploying ? \"Deploying\" : \"Deploy\"}\n        </GlossyGradientButton>\n        <GlossyGradientButton palette=\"sunset\" arrow>\n          Claim offer\n        </GlossyGradientButton>\n        <GlossyGradientButton palette=\"ocean\">Continue</GlossyGradientButton>\n      </div>\n      <div className=\"flex flex-wrap items-end justify-center\" style={{ gap: 10 }}>\n        {([\"sm\", \"md\", \"lg\"] as const).map((sz) => (\n          <GlossyGradientButton key={sz} palette=\"ember\" size={sz}>\n            Size {sz}\n          </GlossyGradientButton>\n        ))}\n      </div>\n    </div>\n  );\n}\n\nexport default GlossyGradientButton;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}