# Password copy with auto clear

> On copy the password dots ripple in a wave and a ring counts down until the clipboard is cleared.

- Category: [Microinteractions](https://library.aimran.es/components/microinteractions)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-mi27-password-copy
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Password managers copy secrets to the clipboard, and good ones clear it again after a few seconds. This entry shows that behavior: pressing copy sends a wave through the masked dots, the icon turns into a check and a ring counts down fifteen seconds before the clipboard is emptied. The eye button flips each dot into its character.

The main color is the copy button and the account icon, the secondary one the countdown ring. Change the password in the markup and the script copies exactly that text. It fits vaults, settings pages and any screen that shows API keys or recovery codes.

## Code

### HTML

```html
<div class="uvq15-pwd"><header><span class="ic" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="m3 7 9 6 9-6"/></svg></span><div><b>Work email</b><small>lucia@estudio.es</small></div></header><div class="fd"><span class="pw" aria-hidden="true" translate="no"><span class="ch" style="--i:0"><i>•</i><b>L</b></span><span class="ch" style="--i:1"><i>•</i><b>i</b></span><span class="ch" style="--i:2"><i>•</i><b>n</b></span><span class="ch" style="--i:3"><i>•</i><b>c</b></span><span class="ch" style="--i:4"><i>•</i><b>e</b></span><span class="ch" style="--i:5"><i>•</i><b>.</b></span><span class="ch" style="--i:6"><i>•</i><b>A</b></span><span class="ch" style="--i:7"><i>•</i><b>z</b></span><span class="ch" style="--i:8"><i>•</i><b>u</b></span><span class="ch" style="--i:9"><i>•</i><b>l</b></span><span class="ch" style="--i:10"><i>•</i><b>.</b></span><span class="ch" style="--i:11"><i>•</i><b>2</b></span><span class="ch" style="--i:12"><i>•</i><b>0</b></span><span class="ch" style="--i:13"><i>•</i><b>2</b></span><span class="ch" style="--i:14"><i>•</i><b>7</b></span></span><button type="button" class="ey" aria-pressed="false" aria-label="Show password"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z"/><circle cx="12" cy="12" r="3"/><path class="sl" d="M4 4l16 16"/></svg></button><button type="button" class="cp" aria-label="Copy password"><span class="a"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="8" y="8" width="12" height="12" rx="2"/><path d="M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"/></svg></span><span class="b"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span></button></div><p class="cd" aria-hidden="true"><span class="rg"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" pathLength="100"/><circle class="t" cx="12" cy="12" r="10" pathLength="100"/></svg><b class="n">15</b></span><span>Will be cleared from the clipboard</span></p><p class="sr" aria-live="polite"></p></div>
```

### CSS

```css
.uvq15-pwd {
  --c1: #be185d;
  --c2: #0ea5e9;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq15-pwd {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  border-radius: 1.3em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent),0 1.4em 2.6em -1.8em rgba(0,0,0,.35);
  width: 19em;
  padding: 1em;
}

.uvq15-pwd header {
  display: flex;
  align-items: center;
  gap: .7em;
  margin-bottom: .85em;
}

.uvq15-pwd .ic {
  display: grid;
  place-items: center;
  width: 2.4em;
  height: 2.4em;
  border-radius: .7em;
  color: #fff;
  background: var(--c1);
}

.uvq15-pwd .ic svg {
  width: 1.2em;
  height: 1.2em;
}

.uvq15-pwd header b {
  display: block;
  font-size: .92em;
}

.uvq15-pwd header small {
  font-size: .75em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-pwd .fd {
  display: flex;
  align-items: center;
  gap: .25em;
  padding: .3em .3em .3em .9em;
  border-radius: .8em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq15-pwd .pw {
  flex: 1;
  display: flex;
  min-width: 0;
  overflow: hidden;
  font: 600 1em ui-monospace,"SF Mono",Menlo,monospace;
  perspective: 20em;
}

.uvq15-pwd .ch {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: .64em;
  height: 1.5em;
}

.uvq15-pwd .ch>* {
  grid-area: 1/1;
  font-style: normal;
  backface-visibility: hidden;
  transition: transform calc(0.35s / var(--k)) cubic-bezier(.22,1,.36,1) calc(var(--i) * calc(0.025s / var(--k))),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(var(--i) * calc(0.025s / var(--k)));
}

.uvq15-pwd .ch i {
  font-size: 1.15em;
}

.uvq15-pwd .ch b {
  font-weight: 600;
  opacity: 0;
  transform: rotateX(90deg);
}

.uvq15-pwd.show .ch i {
  opacity: 0;
  transform: rotateX(-90deg);
}

.uvq15-pwd.show .ch b {
  opacity: 1;
  transform: none;
}

.uvq15-pwd.wv .ch {
  animation: uvq15-pwd-w calc(0.5s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(var(--i) * calc(0.03s / var(--k)));
}

@keyframes uvq15-pwd-w {
  35% {
    transform: translateY(-.4em);
  }
  70% {
    transform: translateY(.08em);
  }
}

.uvq15-pwd .fd button {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: none;
  display: grid;
  place-items: center;
  width: 2.3em;
  height: 2.3em;
  border-radius: .6em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  transition: background calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),color calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),transform .15s cubic-bezier(.25,.1,.25,1);
}

.uvq15-pwd .fd button:hover {
  color: var(--fg);
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq15-pwd .fd button:active {
  transform: scale(.92);
}

.uvq15-pwd .fd button:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq15-pwd .fd svg {
  width: 1.2em;
  height: 1.2em;
}

.uvq15-pwd .ey .sl {
  stroke-dasharray: 23;
  stroke-dashoffset: 23;
  transition: stroke-dashoffset calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-pwd .ey[aria-pressed="true"] .sl {
  stroke-dashoffset: 0;
}

.uvq15-pwd .fd .cp {
  color: #fff;
  background: var(--c1);
}

.uvq15-pwd .fd .cp:hover {
  color: #fff;
  background: color-mix(in srgb,var(--c1) 82%,#000);
}

.uvq15-pwd .cp>span {
  grid-area: 1/1;
  display: grid;
  transition: transform calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-pwd .cp .b {
  opacity: 0;
  transform: scale(.4);
}

.uvq15-pwd.ok .cp .a {
  opacity: 0;
  transform: scale(.4);
}

.uvq15-pwd.ok .cp .b {
  opacity: 1;
  transform: none;
}

.uvq15-pwd .cd {
  display: flex;
  align-items: center;
  gap: .6em;
  margin: .8em 0 0;
  font-size: .78em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  opacity: 0;
  transform: translateY(-.4em);
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq15-pwd.on .cd {
  opacity: 1;
  transform: none;
}

.uvq15-pwd .rg {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.3em;
  height: 2.3em;
}

.uvq15-pwd .rg svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  fill: none;
  stroke-width: 2.4;
}

.uvq15-pwd .rg circle {
  stroke: color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq15-pwd .rg .t {
  stroke: var(--c2);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
}

.uvq15-pwd.on .rg .t {
  animation: uvq15-pwd-r 15s linear forwards;
}

@keyframes uvq15-pwd-r {
  to {
    stroke-dashoffset: 100;
  }
}

.uvq15-pwd .rg b {
  font-size: .9em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.uvq15-pwd .sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion:reduce) {
  .uvq15-pwd,.uvq15-pwd *,.uvq15-pwd *::before,.uvq15-pwd *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
```

### JavaScript

```js
document.querySelectorAll(".uvq15-pwd").forEach(el => {
  const cp=el.querySelector(".cp"),ey=el.querySelector(".ey"),n=el.querySelector(".n"),sr=el.querySelector(".sr"),pw=[...el.querySelectorAll(".ch b")].map(b=>b.textContent).join("");let left=0,iv=0,tm=0;
const stop=()=>{clearInterval(iv);clearTimeout(tm)};
ey.addEventListener("click",()=>{const on=ey.getAttribute("aria-pressed")!=="true";ey.setAttribute("aria-pressed",String(on));ey.setAttribute("aria-label",on?"Hide password":"Show password");el.classList.toggle("show",on)});
cp.addEventListener("click",()=>{if(navigator.clipboard)navigator.clipboard.writeText(pw).catch(()=>{});stop();el.classList.remove("wv","on","ok");void el.offsetWidth;el.classList.add("wv","on","ok");left=15;n.textContent="15";sr.textContent="Password copied";
tm=setTimeout(()=>el.classList.remove("ok"),1500);iv=setInterval(()=>{left--;n.textContent=String(left);if(left>0)return;clearInterval(iv);el.classList.remove("on");if(navigator.clipboard)navigator.clipboard.writeText("").catch(()=>{});sr.textContent="Clipboard cleared"},1000)});return stop
});
```

### React

```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq15-pwd {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  border-radius: 1.3em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent),0 1.4em 2.6em -1.8em rgba(0,0,0,.35);
  width: 19em;
  padding: 1em;
}

.uvq15-pwd header {
  display: flex;
  align-items: center;
  gap: .7em;
  margin-bottom: .85em;
}

.uvq15-pwd .ic {
  display: grid;
  place-items: center;
  width: 2.4em;
  height: 2.4em;
  border-radius: .7em;
  color: #fff;
  background: var(--c1);
}

.uvq15-pwd .ic svg {
  width: 1.2em;
  height: 1.2em;
}

.uvq15-pwd header b {
  display: block;
  font-size: .92em;
}

.uvq15-pwd header small {
  font-size: .75em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-pwd .fd {
  display: flex;
  align-items: center;
  gap: .25em;
  padding: .3em .3em .3em .9em;
  border-radius: .8em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq15-pwd .pw {
  flex: 1;
  display: flex;
  min-width: 0;
  overflow: hidden;
  font: 600 1em ui-monospace,"SF Mono",Menlo,monospace;
  perspective: 20em;
}

.uvq15-pwd .ch {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: .64em;
  height: 1.5em;
}

.uvq15-pwd .ch>* {
  grid-area: 1/1;
  font-style: normal;
  backface-visibility: hidden;
  transition: transform calc(0.35s / var(--k)) cubic-bezier(.22,1,.36,1) calc(var(--i) * calc(0.025s / var(--k))),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(var(--i) * calc(0.025s / var(--k)));
}

.uvq15-pwd .ch i {
  font-size: 1.15em;
}

.uvq15-pwd .ch b {
  font-weight: 600;
  opacity: 0;
  transform: rotateX(90deg);
}

.uvq15-pwd.show .ch i {
  opacity: 0;
  transform: rotateX(-90deg);
}

.uvq15-pwd.show .ch b {
  opacity: 1;
  transform: none;
}

.uvq15-pwd.wv .ch {
  animation: uvq15-pwd-w calc(0.5s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(var(--i) * calc(0.03s / var(--k)));
}

@keyframes uvq15-pwd-w {
  35% {
    transform: translateY(-.4em);
  }
  70% {
    transform: translateY(.08em);
  }
}

.uvq15-pwd .fd button {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: none;
  display: grid;
  place-items: center;
  width: 2.3em;
  height: 2.3em;
  border-radius: .6em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  transition: background calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),color calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),transform .15s cubic-bezier(.25,.1,.25,1);
}

.uvq15-pwd .fd button:hover {
  color: var(--fg);
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq15-pwd .fd button:active {
  transform: scale(.92);
}

.uvq15-pwd .fd button:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq15-pwd .fd svg {
  width: 1.2em;
  height: 1.2em;
}

.uvq15-pwd .ey .sl {
  stroke-dasharray: 23;
  stroke-dashoffset: 23;
  transition: stroke-dashoffset calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-pwd .ey[aria-pressed="true"] .sl {
  stroke-dashoffset: 0;
}

.uvq15-pwd .fd .cp {
  color: #fff;
  background: var(--c1);
}

.uvq15-pwd .fd .cp:hover {
  color: #fff;
  background: color-mix(in srgb,var(--c1) 82%,#000);
}

.uvq15-pwd .cp>span {
  grid-area: 1/1;
  display: grid;
  transition: transform calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-pwd .cp .b {
  opacity: 0;
  transform: scale(.4);
}

.uvq15-pwd.ok .cp .a {
  opacity: 0;
  transform: scale(.4);
}

.uvq15-pwd.ok .cp .b {
  opacity: 1;
  transform: none;
}

.uvq15-pwd .cd {
  display: flex;
  align-items: center;
  gap: .6em;
  margin: .8em 0 0;
  font-size: .78em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  opacity: 0;
  transform: translateY(-.4em);
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq15-pwd.on .cd {
  opacity: 1;
  transform: none;
}

.uvq15-pwd .rg {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.3em;
  height: 2.3em;
}

.uvq15-pwd .rg svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  fill: none;
  stroke-width: 2.4;
}

.uvq15-pwd .rg circle {
  stroke: color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq15-pwd .rg .t {
  stroke: var(--c2);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
}

.uvq15-pwd.on .rg .t {
  animation: uvq15-pwd-r 15s linear forwards;
}

@keyframes uvq15-pwd-r {
  to {
    stroke-dashoffset: 100;
  }
}

.uvq15-pwd .rg b {
  font-size: .9em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.uvq15-pwd .sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion:reduce) {
  .uvq15-pwd,.uvq15-pwd *,.uvq15-pwd *::before,.uvq15-pwd *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const cp=el.querySelector(".cp"),ey=el.querySelector(".ey"),n=el.querySelector(".n"),sr=el.querySelector(".sr"),pw=[...el.querySelectorAll(".ch b")].map(b=>b.textContent).join("");let left=0,iv=0,tm=0;
const stop=()=>{clearInterval(iv);clearTimeout(tm)};
ey.addEventListener("click",()=>{const on=ey.getAttribute("aria-pressed")!=="true";ey.setAttribute("aria-pressed",String(on));ey.setAttribute("aria-label",on?"Hide password":"Show password");el.classList.toggle("show",on)});
cp.addEventListener("click",()=>{if(navigator.clipboard)navigator.clipboard.writeText(pw).catch(()=>{});stop();el.classList.remove("wv","on","ok");void el.offsetWidth;el.classList.add("wv","on","ok");left=15;n.textContent="15";sr.textContent="Password copied";
tm=setTimeout(()=>el.classList.remove("ok"),1500);iv=setInterval(()=>{left--;n.textContent=String(left);if(left>0)return;clearInterval(iv);el.classList.remove("on");if(navigator.clipboard)navigator.clipboard.writeText("").catch(()=>{});sr.textContent="Clipboard cleared"},1000)});return stop
}

export default function Mi27PasswordCopy() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#be185d",
          "--c2": "#0ea5e9",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq15-pwd"><header><span className="ic" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2" /><path d="m3 7 9 6 9-6" /></svg></span><div><b>Work email</b><small>lucia@estudio.es</small></div></header><div className="fd"><span className="pw" aria-hidden="true" translate="no"><span className="ch" style={{ "--i": "0" } as CSSProperties}><i>•</i><b>L</b></span><span className="ch" style={{ "--i": "1" } as CSSProperties}><i>•</i><b>i</b></span><span className="ch" style={{ "--i": "2" } as CSSProperties}><i>•</i><b>n</b></span><span className="ch" style={{ "--i": "3" } as CSSProperties}><i>•</i><b>c</b></span><span className="ch" style={{ "--i": "4" } as CSSProperties}><i>•</i><b>e</b></span><span className="ch" style={{ "--i": "5" } as CSSProperties}><i>•</i><b>.</b></span><span className="ch" style={{ "--i": "6" } as CSSProperties}><i>•</i><b>A</b></span><span className="ch" style={{ "--i": "7" } as CSSProperties}><i>•</i><b>z</b></span><span className="ch" style={{ "--i": "8" } as CSSProperties}><i>•</i><b>u</b></span><span className="ch" style={{ "--i": "9" } as CSSProperties}><i>•</i><b>l</b></span><span className="ch" style={{ "--i": "10" } as CSSProperties}><i>•</i><b>.</b></span><span className="ch" style={{ "--i": "11" } as CSSProperties}><i>•</i><b>2</b></span><span className="ch" style={{ "--i": "12" } as CSSProperties}><i>•</i><b>0</b></span><span className="ch" style={{ "--i": "13" } as CSSProperties}><i>•</i><b>2</b></span><span className="ch" style={{ "--i": "14" } as CSSProperties}><i>•</i><b>7</b></span></span><button type="button" className="ey" aria-pressed="false" aria-label="Show password"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z" /><circle cx="12" cy="12" r="3" /><path className="sl" d="M4 4l16 16" /></svg></button><button type="button" className="cp" aria-label="Copy password"><span className="a"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><rect x="8" y="8" width="12" height="12" rx="2" /><path d="M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2" /></svg></span><span className="b"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.6" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5" /></svg></span></button></div><p className="cd" aria-hidden="true"><span className="rg"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" pathLength="100" /><circle className="t" cx="12" cy="12" r="10" pathLength="100" /></svg><b className="n">15</b></span><span>Will be cleared from the clipboard</span></p><p className="sr" aria-live="polite"></p></div>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Password copy with auto clear” block (Microinteractions) from AIMRAN Library to my project.

## What it is
On copy the password dots ripple in a wave and a ring counts down until the clipboard is cleared.

## Chosen settings
- Main color: #be185d
- Secondary color: #0ea5e9
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Copiar contraseña"

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with plain HTML and CSS (the reference wraps it in a React component with its CSS). If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq15-pwd {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  border-radius: 1.3em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent),0 1.4em 2.6em -1.8em rgba(0,0,0,.35);
  width: 19em;
  padding: 1em;
}

.uvq15-pwd header {
  display: flex;
  align-items: center;
  gap: .7em;
  margin-bottom: .85em;
}

.uvq15-pwd .ic {
  display: grid;
  place-items: center;
  width: 2.4em;
  height: 2.4em;
  border-radius: .7em;
  color: #fff;
  background: var(--c1);
}

.uvq15-pwd .ic svg {
  width: 1.2em;
  height: 1.2em;
}

.uvq15-pwd header b {
  display: block;
  font-size: .92em;
}

.uvq15-pwd header small {
  font-size: .75em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq15-pwd .fd {
  display: flex;
  align-items: center;
  gap: .25em;
  padding: .3em .3em .3em .9em;
  border-radius: .8em;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq15-pwd .pw {
  flex: 1;
  display: flex;
  min-width: 0;
  overflow: hidden;
  font: 600 1em ui-monospace,"SF Mono",Menlo,monospace;
  perspective: 20em;
}

.uvq15-pwd .ch {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: .64em;
  height: 1.5em;
}

.uvq15-pwd .ch>* {
  grid-area: 1/1;
  font-style: normal;
  backface-visibility: hidden;
  transition: transform calc(0.35s / var(--k)) cubic-bezier(.22,1,.36,1) calc(var(--i) * calc(0.025s / var(--k))),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(var(--i) * calc(0.025s / var(--k)));
}

.uvq15-pwd .ch i {
  font-size: 1.15em;
}

.uvq15-pwd .ch b {
  font-weight: 600;
  opacity: 0;
  transform: rotateX(90deg);
}

.uvq15-pwd.show .ch i {
  opacity: 0;
  transform: rotateX(-90deg);
}

.uvq15-pwd.show .ch b {
  opacity: 1;
  transform: none;
}

.uvq15-pwd.wv .ch {
  animation: uvq15-pwd-w calc(0.5s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(var(--i) * calc(0.03s / var(--k)));
}

@keyframes uvq15-pwd-w {
  35% {
    transform: translateY(-.4em);
  }
  70% {
    transform: translateY(.08em);
  }
}

.uvq15-pwd .fd button {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: none;
  display: grid;
  place-items: center;
  width: 2.3em;
  height: 2.3em;
  border-radius: .6em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  transition: background calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),color calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),transform .15s cubic-bezier(.25,.1,.25,1);
}

.uvq15-pwd .fd button:hover {
  color: var(--fg);
  background: color-mix(in srgb,var(--fg) 6%,transparent);
}

.uvq15-pwd .fd button:active {
  transform: scale(.92);
}

.uvq15-pwd .fd button:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq15-pwd .fd svg {
  width: 1.2em;
  height: 1.2em;
}

.uvq15-pwd .ey .sl {
  stroke-dasharray: 23;
  stroke-dashoffset: 23;
  transition: stroke-dashoffset calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-pwd .ey[aria-pressed="true"] .sl {
  stroke-dashoffset: 0;
}

.uvq15-pwd .fd .cp {
  color: #fff;
  background: var(--c1);
}

.uvq15-pwd .fd .cp:hover {
  color: #fff;
  background: color-mix(in srgb,var(--c1) 82%,#000);
}

.uvq15-pwd .cp>span {
  grid-area: 1/1;
  display: grid;
  transition: transform calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq15-pwd .cp .b {
  opacity: 0;
  transform: scale(.4);
}

.uvq15-pwd.ok .cp .a {
  opacity: 0;
  transform: scale(.4);
}

.uvq15-pwd.ok .cp .b {
  opacity: 1;
  transform: none;
}

.uvq15-pwd .cd {
  display: flex;
  align-items: center;
  gap: .6em;
  margin: .8em 0 0;
  font-size: .78em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  opacity: 0;
  transform: translateY(-.4em);
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.4s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq15-pwd.on .cd {
  opacity: 1;
  transform: none;
}

.uvq15-pwd .rg {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.3em;
  height: 2.3em;
}

.uvq15-pwd .rg svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  fill: none;
  stroke-width: 2.4;
}

.uvq15-pwd .rg circle {
  stroke: color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq15-pwd .rg .t {
  stroke: var(--c2);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
}

.uvq15-pwd.on .rg .t {
  animation: uvq15-pwd-r 15s linear forwards;
}

@keyframes uvq15-pwd-r {
  to {
    stroke-dashoffset: 100;
  }
}

.uvq15-pwd .rg b {
  font-size: .9em;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.uvq15-pwd .sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion:reduce) {
  .uvq15-pwd,.uvq15-pwd *,.uvq15-pwd *::before,.uvq15-pwd *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const cp=el.querySelector(".cp"),ey=el.querySelector(".ey"),n=el.querySelector(".n"),sr=el.querySelector(".sr"),pw=[...el.querySelectorAll(".ch b")].map(b=>b.textContent).join("");let left=0,iv=0,tm=0;
const stop=()=>{clearInterval(iv);clearTimeout(tm)};
ey.addEventListener("click",()=>{const on=ey.getAttribute("aria-pressed")!=="true";ey.setAttribute("aria-pressed",String(on));ey.setAttribute("aria-label",on?"Hide password":"Show password");el.classList.toggle("show",on)});
cp.addEventListener("click",()=>{if(navigator.clipboard)navigator.clipboard.writeText(pw).catch(()=>{});stop();el.classList.remove("wv","on","ok");void el.offsetWidth;el.classList.add("wv","on","ok");left=15;n.textContent="15";sr.textContent="Password copied";
tm=setTimeout(()=>el.classList.remove("ok"),1500);iv=setInterval(()=>{left--;n.textContent=String(left);if(left>0)return;clearInterval(iv);el.classList.remove("on");if(navigator.clipboard)navigator.clipboard.writeText("").catch(()=>{});sr.textContent="Clipboard cleared"},1000)});return stop
}

export default function Mi27PasswordCopy() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#be185d",
          "--c2": "#0ea5e9",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq15-pwd"><header><span className="ic" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2" /><path d="m3 7 9 6 9-6" /></svg></span><div><b>Work email</b><small>lucia@estudio.es</small></div></header><div className="fd"><span className="pw" aria-hidden="true" translate="no"><span className="ch" style={{ "--i": "0" } as CSSProperties}><i>•</i><b>L</b></span><span className="ch" style={{ "--i": "1" } as CSSProperties}><i>•</i><b>i</b></span><span className="ch" style={{ "--i": "2" } as CSSProperties}><i>•</i><b>n</b></span><span className="ch" style={{ "--i": "3" } as CSSProperties}><i>•</i><b>c</b></span><span className="ch" style={{ "--i": "4" } as CSSProperties}><i>•</i><b>e</b></span><span className="ch" style={{ "--i": "5" } as CSSProperties}><i>•</i><b>.</b></span><span className="ch" style={{ "--i": "6" } as CSSProperties}><i>•</i><b>A</b></span><span className="ch" style={{ "--i": "7" } as CSSProperties}><i>•</i><b>z</b></span><span className="ch" style={{ "--i": "8" } as CSSProperties}><i>•</i><b>u</b></span><span className="ch" style={{ "--i": "9" } as CSSProperties}><i>•</i><b>l</b></span><span className="ch" style={{ "--i": "10" } as CSSProperties}><i>•</i><b>.</b></span><span className="ch" style={{ "--i": "11" } as CSSProperties}><i>•</i><b>2</b></span><span className="ch" style={{ "--i": "12" } as CSSProperties}><i>•</i><b>0</b></span><span className="ch" style={{ "--i": "13" } as CSSProperties}><i>•</i><b>2</b></span><span className="ch" style={{ "--i": "14" } as CSSProperties}><i>•</i><b>7</b></span></span><button type="button" className="ey" aria-pressed="false" aria-label="Show password"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z" /><circle cx="12" cy="12" r="3" /><path className="sl" d="M4 4l16 16" /></svg></button><button type="button" className="cp" aria-label="Copy password"><span className="a"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><rect x="8" y="8" width="12" height="12" rx="2" /><path d="M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2" /></svg></span><span className="b"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.6" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5" /></svg></span></button></div><p className="cd" aria-hidden="true"><span className="rg"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" pathLength="100" /><circle className="t" cx="12" cy="12" r="10" pathLength="100" /></svg><b className="n">15</b></span><span>Will be cleared from the clipboard</span></p><p className="sr" aria-live="polite"></p></div>
      </div>
    </>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
