{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "button-split-halves",
  "type": "registry:component",
  "title": "Button Split Halves",
  "description": "The label is cut in two and the halves slide apart on hover, uncovering an alternate label or icon underneath.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "buttons",
    "button",
    "split",
    "reveal",
    "hover",
    "label",
    "swap"
  ],
  "docs": "https://hyperblur.dev/effects/button-split-halves",
  "files": [
    {
      "path": "registry/hyperblur/button-split-halves.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/button-split-halves.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface ButtonSplitHalvesProps\n  extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"color\"> {\n  reveal?: React.ReactNode;\n  icon?: React.ReactNode;\n  axis?: \"x\" | \"y\";\n  variant?: \"light\" | \"dark\" | \"accent\";\n  accent?: string;\n  size?: \"sm\" | \"md\" | \"lg\";\n  open?: boolean;\n  loading?: boolean;\n}\n\nconst css = `\n.hb-ya4 {\n  --hb-ya4-h: 2.9rem;\n  --hb-ya4-fs: 0.9375rem;\n  position: relative;\n  display: inline-grid;\n  box-sizing: border-box;\n  margin: 0;\n  padding: 0;\n  overflow: hidden;\n  isolation: isolate;\n  font: inherit;\n  font-size: var(--hb-ya4-fs);\n  font-weight: 600;\n  line-height: 1;\n  white-space: nowrap;\n  border: 1px solid var(--hb-ya4-line);\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-ya4 *, .hb-ya4 *::before, .hb-ya4 *::after { box-sizing: border-box; }\n.hb-ya4[data-size=\"sm\"] { --hb-ya4-h: 2.4rem; --hb-ya4-fs: 0.8125rem; }\n.hb-ya4[data-size=\"lg\"] { --hb-ya4-h: 3.4rem; --hb-ya4-fs: 1.0625rem; }\n.hb-ya4[data-variant=\"light\"] {\n  --hb-ya4-door: #f2f2f3;\n  --hb-ya4-fg: #0a0a0a;\n  --hb-ya4-alt: var(--hb-ya4-c);\n  --hb-ya4-altfg: #fff;\n  --hb-ya4-line: rgba(255, 255, 255, 0.2);\n}\n.hb-ya4[data-variant=\"dark\"] {\n  --hb-ya4-door: #131314;\n  --hb-ya4-fg: #ededed;\n  --hb-ya4-alt: var(--hb-ya4-c);\n  --hb-ya4-altfg: #fff;\n  --hb-ya4-line: #2a2a2a;\n}\n.hb-ya4[data-variant=\"accent\"] {\n  --hb-ya4-door: var(--hb-ya4-c);\n  --hb-ya4-fg: #fff;\n  --hb-ya4-alt: #f2f2f3;\n  --hb-ya4-altfg: #0a0a0a;\n  --hb-ya4-line: transparent;\n}\n.hb-ya4:not(:disabled):active { transform: scale(0.97); }\n.hb-ya4:focus-visible { outline: 2px solid var(--hb-ya4-c); outline-offset: 3px; }\n.hb-ya4:disabled { opacity: 0.45; cursor: not-allowed; }\n.hb-ya4[aria-busy=\"true\"] { cursor: progress; }\n.hb-ya4-alt {\n  grid-area: 1 / 1;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  gap: 0.55em;\n  height: var(--hb-ya4-h);\n  padding: 0 1.7em;\n  color: var(--hb-ya4-altfg);\n  background: var(--hb-ya4-alt);\n  opacity: 0.6;\n  transform: scale(0.9);\n  transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.3, 0.9, 0.3, 1);\n}\n.hb-ya4-alt > svg { width: 1.1em; height: 1.1em; flex: none; }\n.hb-ya4-half {\n  grid-area: 1 / 1;\n  display: grid;\n  place-items: center;\n  height: var(--hb-ya4-h);\n  padding: 0 1.7em;\n  color: var(--hb-ya4-fg);\n  background: var(--hb-ya4-door);\n  transition: transform 0.5s cubic-bezier(0.7, 0, 0.2, 1);\n}\n.hb-ya4[data-axis=\"y\"] .hb-ya4-a { clip-path: inset(0 0 calc(50% - 0.5px) 0); }\n.hb-ya4[data-axis=\"y\"] .hb-ya4-b { clip-path: inset(calc(50% - 0.5px) 0 0 0); }\n.hb-ya4[data-axis=\"x\"] .hb-ya4-a { clip-path: inset(0 calc(50% - 0.5px) 0 0); }\n.hb-ya4[data-axis=\"x\"] .hb-ya4-b { clip-path: inset(0 0 0 calc(50% - 0.5px)); }\n.hb-ya4:not(:disabled):hover .hb-ya4-alt,\n.hb-ya4:not(:disabled):focus-visible .hb-ya4-alt,\n.hb-ya4[data-open=\"true\"] .hb-ya4-alt { opacity: 1; transform: none; }\n.hb-ya4[data-axis=\"y\"]:not(:disabled):hover .hb-ya4-a,\n.hb-ya4[data-axis=\"y\"]:not(:disabled):focus-visible .hb-ya4-a,\n.hb-ya4[data-axis=\"y\"][data-open=\"true\"] .hb-ya4-a { transform: translateY(-64%); }\n.hb-ya4[data-axis=\"y\"]:not(:disabled):hover .hb-ya4-b,\n.hb-ya4[data-axis=\"y\"]:not(:disabled):focus-visible .hb-ya4-b,\n.hb-ya4[data-axis=\"y\"][data-open=\"true\"] .hb-ya4-b { transform: translateY(64%); }\n.hb-ya4[data-axis=\"x\"]:not(:disabled):hover .hb-ya4-a,\n.hb-ya4[data-axis=\"x\"]:not(:disabled):focus-visible .hb-ya4-a,\n.hb-ya4[data-axis=\"x\"][data-open=\"true\"] .hb-ya4-a { transform: translateX(-64%); }\n.hb-ya4[data-axis=\"x\"]:not(:disabled):hover .hb-ya4-b,\n.hb-ya4[data-axis=\"x\"]:not(:disabled):focus-visible .hb-ya4-b,\n.hb-ya4[data-axis=\"x\"][data-open=\"true\"] .hb-ya4-b { transform: translateX(64%); }\n.hb-ya4-spin {\n  width: 1.05em;\n  height: 1.05em;\n  border: 2px solid currentColor;\n  border-right-color: transparent;\n  border-radius: 50%;\n  animation: hb-ya4-turn 0.7s linear infinite;\n}\n@keyframes hb-ya4-turn {\n  to { transform: rotate(360deg); }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-ya4, .hb-ya4-alt, .hb-ya4-half { transition: none; }\n  .hb-ya4:not(:disabled):active { transform: none; }\n  .hb-ya4-spin { animation-duration: 2s; }\n}\n`;\n\nexport function ButtonSplitHalves({\n  reveal = \"Let's go\",\n  icon,\n  axis = \"y\",\n  variant = \"light\",\n  accent = \"#2f7bff\",\n  size = \"md\",\n  open = false,\n  loading = false,\n  disabled = false,\n  type = \"button\",\n  className = \"\",\n  style,\n  children,\n  onClick,\n  ...rest\n}: ButtonSplitHalvesProps) {\n  const vars = { \"--hb-ya4-c\": accent, ...style } as React.CSSProperties;\n\n  return (\n    <>\n      <style href=\"hb-button-split-halves\" precedence=\"default\">{css}</style>\n      <button\n        type={type}\n        className={`hb-ya4 ${className}`}\n        style={vars}\n        data-variant={variant}\n        data-size={size}\n        data-axis={axis}\n        data-open={open || loading}\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-ya4-alt\" aria-hidden=\"true\">\n          {loading ? <span className=\"hb-ya4-spin\" /> : icon}\n          {loading ? null : reveal}\n        </span>\n        <span className=\"hb-ya4-half hb-ya4-a\">{children}</span>\n        <span className=\"hb-ya4-half hb-ya4-b\" aria-hidden=\"true\">{children}</span>\n      </button>\n    </>\n  );\n}\n"
    }
  ]
}