{
  "id": "spinner-overlay-button",
  "name": "Spinner Overlay Button",
  "category": "buttons",
  "tags": [
    "loading",
    "aria-busy",
    "no layout shift",
    "submit",
    "state"
  ],
  "description": "A loading button that swaps its label for a centered spinner without changing width, driven by aria-busy.",
  "url": "https://copy-css.com/snippets/spinner-overlay-button",
  "markdown": "https://copy-css.com/snippets/spinner-overlay-button.md",
  "html": "<button class=\"btn-busy\">Save changes</button>\n<button class=\"btn-busy\" aria-busy=\"true\">Save changes</button>",
  "css": ".btn-busy {\n  position: relative;\n  padding: 14px 28px;\n  border: 0;\n  border-radius: 10px;\n  background: #4f46e5;\n  color: #fff;\n  font: 600 16px/1 system-ui, sans-serif;\n  cursor: pointer;\n}\n\n.btn-busy:hover {\n  background: #4338ca;\n}\n\n/* The label keeps its space, so the button never changes size */\n.btn-busy[aria-busy=\"true\"] {\n  color: transparent;\n  pointer-events: none;\n}\n\n.btn-busy[aria-busy=\"true\"]::after {\n  content: \"\";\n  position: absolute;\n  inset: 0;\n  width: 18px;\n  height: 18px;\n  margin: auto;\n  border: 2.5px solid #ffffff66;\n  border-top-color: #fff;\n  border-radius: 50%;\n  animation: btn-busy-spin 0.7s linear infinite;\n}\n\n.btn-busy:focus-visible {\n  outline: 3px solid #a5b4fc;\n  outline-offset: 3px;\n}\n\n@keyframes btn-busy-spin {\n  to { transform: rotate(1turn); }\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .btn-busy[aria-busy=\"true\"]::after { animation-duration: 2s; }\n}",
  "features": [
    "keyframe animations",
    "transforms",
    "keyboard focus styles",
    "reduced-motion support"
  ],
  "customProperties": []
}
