Copy Feedback
A copy-paste micro-interactions component in pure HTML, CSS & vanilla JS. Zero dependencies, framework-agnostic, MIT-licensed.
Micro-interactionsHTMLCSSJavaScriptany framework
Copy into your project
HTML
<button class="nuda-copy-feedback" data-copy="hello@nudaui.dev">
<span class="nuda-copy-feedback__idle">Copy</span>
<span class="nuda-copy-feedback__done">Copied!</span>
</button>CSS
/* Copy Feedback — "Copy" slides out as "Copied!" slides in on click. */
.nuda-copy-feedback {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 96px;
padding: 10px 18px;
background: #0c0c10;
color: #fafafa;
border: 1px solid rgba(255, 255, 255, 0.15);
border-radius: 9px;
font-weight: 600;
cursor: pointer;
overflow: hidden;
transition: border-color 0.25s, color 0.25s;
}
.nuda-copy-feedback__idle,
.nuda-copy-feedback__done {
display: inline-block;
transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s;
}
.nuda-copy-feedback__done {
position: absolute;
opacity: 0;
transform: translateY(120%);
color: #e4ff54;
}
.nuda-copy-feedback.is-copied { border-color: #e4ff54; }
.nuda-copy-feedback.is-copied .nuda-copy-feedback__idle {
opacity: 0;
transform: translateY(-120%);
}
.nuda-copy-feedback.is-copied .nuda-copy-feedback__done {
opacity: 1;
transform: translateY(0);
}
.nuda-copy-feedback:focus-visible {
outline: 2px solid #e4ff54;
outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
.nuda-copy-feedback__idle,
.nuda-copy-feedback__done { transition: opacity 0.2s; }
}JavaScript
/* Copy Feedback — vanilla JS
Copies data-copy text and morphs the label to "Copied!". */
(function () {
document.querySelectorAll(".nuda-copy-feedback").forEach(function (btn) {
btn.addEventListener("click", function () {
var text = btn.getAttribute("data-copy") || "";
if (navigator.clipboard) navigator.clipboard.writeText(text);
btn.classList.add("is-copied");
setTimeout(function () { btn.classList.remove("is-copied"); }, 1500);
});
});
})();How to use Copy Feedback
Paste the HTML where you need it and the CSS into a global stylesheet (or a <style> tag). Every class is prefixed nuda- so it never collides with Tailwind or your own styles. Tweak the CSS custom properties to match your design system.
Works in React, Vue, Svelte, Astro, Next.js, Nuxt, Laravel Blade, Django, Rails — or a single .html file. No npm install, no build step.