{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"frost-tiles","type":"registry:ui","title":"Frost Tiles","description":"Icon tiles with a colored backplate behind a frosted glass front that lifts and tilts toward the pointer on hover.","dependencies":[],"registryDependencies":["utils"],"files":[{"path":"registry/ui/frost-tiles.tsx","type":"registry:ui","content":"\"use client\";\n\nimport type { PointerEvent, ReactNode } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface GlassIconItem {\n  icon: ReactNode;\n  label: string;\n  /** Backplate color. */\n  color?: string;\n  onClick?: () => void;\n}\n\nexport interface FrostTilesProps {\n  items: GlassIconItem[];\n  /** Tile size in px. */\n  size?: number;\n  /** Max pointer tilt of the glass in degrees. */\n  tilt?: number;\n  /** Show the label under a hovered tile. */\n  showLabels?: boolean;\n  className?: string;\n}\n\nconst PALETTE = [\"#3b82f6\", \"#a855f7\", \"#f43f5e\", \"#6366f1\", \"#f59e0b\", \"#10b981\"];\nconst EASE = \"cubic-bezier(.34,1.4,.5,1)\";\n\nexport function FrostTiles({ items, size = 72, tilt = 18, showLabels = true, className }: FrostTilesProps) {\n  const onMove = (e: PointerEvent<HTMLButtonElement>) => {\n    const el = e.currentTarget;\n    const r = el.getBoundingClientRect();\n    const px = (e.clientX - r.left) / r.width - 0.5;\n    const py = (e.clientY - r.top) / r.height - 0.5;\n    el.style.setProperty(\"--gi-rx\", `${-py * tilt * 2}deg`);\n    el.style.setProperty(\"--gi-ry\", `${px * tilt * 2}deg`);\n  };\n  const onLeave = (e: PointerEvent<HTMLButtonElement>) => {\n    e.currentTarget.style.setProperty(\"--gi-rx\", \"0deg\");\n    e.currentTarget.style.setProperty(\"--gi-ry\", \"0deg\");\n  };\n\n  return (\n    <div className={cn(\"flex flex-wrap items-start justify-center\", className)} style={{ gap: size * 0.5, paddingBottom: size * 0.45 }}>\n      {items.map((it, i) => {\n        const color = it.color ?? PALETTE[i % PALETTE.length];\n        return (\n          <button\n            key={it.label}\n            type=\"button\"\n            aria-label={it.label}\n            onClick={it.onClick}\n            onPointerMove={onMove}\n            onPointerLeave={onLeave}\n            className=\"group relative shrink-0 rounded-[28%] outline-none [perspective:500px] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-4 focus-visible:ring-offset-background\"\n            style={{ width: size, height: size }}\n          >\n            {/* colored backplate */}\n            <span\n              aria-hidden\n              className=\"absolute inset-0 rounded-[28%] shadow-[0_12px_28px_-10px_rgba(0,0,0,.6)] [transform:translate3d(-7%,-7%,0)_rotate(15deg)_scale(.92)] group-hover:[transform:translate3d(-14%,-12%,0)_rotate(26deg)_scale(.92)] group-focus-visible:[transform:translate3d(-14%,-12%,0)_rotate(26deg)_scale(.92)]\"\n              style={{\n                background: `linear-gradient(145deg, color-mix(in oklab, ${color} 80%, white), ${color} 45%, color-mix(in oklab, ${color} 65%, black))`,\n                transition: `transform .5s ${EASE}`,\n              }}\n            />\n            {/* frosted glass front */}\n            <span\n              aria-hidden\n              className=\"absolute inset-0 grid place-items-center rounded-[28%] border border-white/25 text-white backdrop-blur-md backdrop-saturate-150 [transform:translate3d(0,0,0)] group-hover:[transform:translate3d(5%,5%,30px)_rotateX(var(--gi-rx,0deg))_rotateY(var(--gi-ry,0deg))] group-focus-visible:[transform:translate3d(5%,5%,30px)]\"\n              style={{\n                background: \"linear-gradient(135deg, rgba(255,255,255,.3), rgba(255,255,255,.08) 55%, rgba(255,255,255,.14))\",\n                boxShadow: \"inset 0 1px 0 rgba(255,255,255,.45), inset 0 -1px 0 rgba(255,255,255,.1)\",\n                transition: `transform .45s ${EASE}`,\n              }}\n            >\n              <span className=\"grid size-[44%] place-items-center drop-shadow-[0_2px_6px_rgba(0,0,0,.25)] [&>svg]:size-full\">\n                {it.icon}\n              </span>\n            </span>\n            {showLabels && (\n              <span className=\"pointer-events-none absolute left-1/2 top-full mt-3 -translate-x-1/2 translate-y-1 whitespace-nowrap text-sm font-medium text-foreground opacity-0 transition-[opacity,transform] duration-300 group-hover:translate-y-0 group-hover:opacity-100 group-focus-visible:translate-y-0 group-focus-visible:opacity-100\">\n                {it.label}\n              </span>\n            )}\n          </button>\n        );\n      })}\n    </div>\n  );\n}\n"}]}