{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "button-border-spin",
  "type": "registry:component",
  "title": "Button Border Spin",
  "description": "A pill button with a conic gradient comet orbiting its edge around a solid inner face. The border spins all the time or only on hover.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "buttons",
    "button",
    "border",
    "gradient",
    "conic",
    "spin",
    "glow"
  ],
  "docs": "https://hyperblur.dev/effects/button-border-spin",
  "files": [
    {
      "path": "registry/hyperblur/button-border-spin.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/button-border-spin.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface ButtonBorderSpinProps\n  extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"color\"> {\n  variant?: \"dark\" | \"light\" | \"accent\";\n  accent?: string;\n  size?: \"sm\" | \"md\" | \"lg\";\n  spin?: \"always\" | \"hover\";\n  duration?: number;\n  loading?: boolean;\n}\n\nconst css = `\n.hb-ya2 {\n  --hb-ya2-h: 2.75rem;\n  --hb-ya2-fs: 0.9375rem;\n  --hb-ya2-w: 1.5px;\n  position: relative;\n  display: inline-flex;\n  box-sizing: border-box;\n  margin: 0;\n  padding: var(--hb-ya2-w);\n  overflow: hidden;\n  isolation: isolate;\n  font: inherit;\n  font-size: var(--hb-ya2-fs);\n  background: rgba(255, 255, 255, 0.12);\n  border: 0;\n  border-radius: 999px;\n  cursor: pointer;\n  user-select: none;\n  -webkit-user-select: none;\n  -webkit-tap-highlight-color: transparent;\n  transition: transform 0.18s cubic-bezier(0.3, 1.4, 0.5, 1);\n}\n.hb-ya2 *, .hb-ya2 *::before, .hb-ya2 *::after { box-sizing: border-box; }\n.hb-ya2[data-size=\"sm\"] { --hb-ya2-h: 2.25rem; --hb-ya2-fs: 0.8125rem; }\n.hb-ya2[data-size=\"lg\"] { --hb-ya2-h: 3.25rem; --hb-ya2-fs: 1.0625rem; }\n.hb-ya2[data-variant=\"dark\"] {\n  --hb-ya2-face: #0b0b0c;\n  --hb-ya2-fg: #ededed;\n  --hb-ya2-b: var(--hb-ya2-c);\n  --hb-ya2-tip: color-mix(in srgb, var(--hb-ya2-c) 35%, #fff);\n}\n.hb-ya2[data-variant=\"light\"] {\n  --hb-ya2-face: #f4f4f5;\n  --hb-ya2-fg: #0a0a0a;\n  --hb-ya2-b: var(--hb-ya2-c);\n  --hb-ya2-tip: color-mix(in srgb, var(--hb-ya2-c) 70%, #fff);\n}\n.hb-ya2[data-variant=\"accent\"] {\n  --hb-ya2-face: var(--hb-ya2-c);\n  --hb-ya2-fg: #fff;\n  --hb-ya2-b: rgba(255, 255, 255, 0.55);\n  --hb-ya2-tip: #fff;\n}\n.hb-ya2:not(:disabled):active { transform: scale(0.97); }\n.hb-ya2:focus-visible { outline: 2px solid var(--hb-ya2-c); outline-offset: 3px; }\n.hb-ya2:disabled { opacity: 0.45; cursor: not-allowed; }\n.hb-ya2[aria-busy=\"true\"] { cursor: progress; }\n.hb-ya2-ring {\n  position: absolute;\n  inset: 0;\n  z-index: 0;\n  overflow: hidden;\n  border-radius: inherit;\n  pointer-events: none;\n  transition: opacity 0.35s ease;\n}\n.hb-ya2-sweep {\n  position: absolute;\n  left: 50%;\n  top: 50%;\n  width: 280%;\n  aspect-ratio: 1;\n  background: conic-gradient(\n    from 0deg,\n    transparent 0 36%,\n    var(--hb-ya2-b) 47%,\n    var(--hb-ya2-tip) 50%,\n    transparent 50.4% 86%,\n    var(--hb-ya2-b) 97%,\n    var(--hb-ya2-tip) 100%\n  );\n  transform: translate(-50%, -50%) rotate(0deg);\n  animation: hb-ya2-turn var(--hb-ya2-t, 3s) linear infinite;\n}\n.hb-ya2[data-spin=\"hover\"] .hb-ya2-ring { opacity: 0; }\n.hb-ya2[data-spin=\"hover\"]:not(:disabled):hover .hb-ya2-ring,\n.hb-ya2[data-spin=\"hover\"]:focus-visible .hb-ya2-ring { opacity: 1; }\n.hb-ya2[data-spin=\"hover\"] .hb-ya2-sweep { animation-play-state: paused; }\n.hb-ya2[data-spin=\"hover\"]:not(:disabled):hover .hb-ya2-sweep,\n.hb-ya2[data-spin=\"hover\"]:focus-visible .hb-ya2-sweep { animation-play-state: running; }\n.hb-ya2-face {\n  position: relative;\n  z-index: 1;\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  gap: 0.6em;\n  height: calc(var(--hb-ya2-h) - var(--hb-ya2-w) * 2);\n  padding: 0 1.5em;\n  font-weight: 600;\n  line-height: 1;\n  white-space: nowrap;\n  color: var(--hb-ya2-fg);\n  background: var(--hb-ya2-face);\n  border-radius: 999px;\n  transition: filter 0.2s ease;\n}\n.hb-ya2:not(:disabled):hover .hb-ya2-face { filter: brightness(1.12); }\n.hb-ya2-spin {\n  width: 1em;\n  height: 1em;\n  border: 2px solid currentColor;\n  border-right-color: transparent;\n  border-radius: 50%;\n  animation: hb-ya2-orbit 0.7s linear infinite;\n}\n@keyframes hb-ya2-turn {\n  to { transform: translate(-50%, -50%) rotate(360deg); }\n}\n@keyframes hb-ya2-orbit {\n  to { transform: rotate(360deg); }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-ya2, .hb-ya2-ring, .hb-ya2-face { transition: none; }\n  .hb-ya2:not(:disabled):active { transform: none; }\n  .hb-ya2-sweep { animation: none; transform: translate(-50%, -50%) rotate(40deg); }\n  .hb-ya2-spin { animation-duration: 2s; }\n}\n`;\n\nexport function ButtonBorderSpin({\n  variant = \"dark\",\n  accent = \"#2f7bff\",\n  size = \"md\",\n  spin = \"always\",\n  duration = 3,\n  loading = false,\n  disabled = false,\n  type = \"button\",\n  className = \"\",\n  style,\n  children,\n  onClick,\n  ...rest\n}: ButtonBorderSpinProps) {\n  const vars = {\n    \"--hb-ya2-c\": accent,\n    \"--hb-ya2-t\": `${Math.max(0.4, duration).toFixed(2)}s`,\n    ...style,\n  } as React.CSSProperties;\n\n  return (\n    <>\n      <style href=\"hb-button-border-spin\" precedence=\"default\">{css}</style>\n      <button\n        type={type}\n        className={`hb-ya2 ${className}`}\n        style={vars}\n        data-variant={variant}\n        data-size={size}\n        data-spin={spin}\n        disabled={disabled}\n        aria-busy={loading || undefined}\n        onClick={(e) => {\n          if (loading) {\n            e.preventDefault();\n            return;\n          }\n          onClick?.(e);\n        }}\n        {...rest}\n      >\n        <span className=\"hb-ya2-ring\" aria-hidden=\"true\">\n          <span className=\"hb-ya2-sweep\" />\n        </span>\n        <span className=\"hb-ya2-face\">\n          {loading ? <span className=\"hb-ya2-spin\" aria-hidden=\"true\" /> : null}\n          {children}\n        </span>\n      </button>\n    </>\n  );\n}\n"
    }
  ]
}