Chip Remove Animation
A copy-paste tags & chips input component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.
Tags & Chips InputHTMLCSSany framework
designanimationmotion
Copy into your project
HTML
<div class="nuda-chip-remove">
<span class="nuda-chip-remove__chip">
design
<button class="nuda-chip-remove__x" aria-label="Remove design">×</button>
</span>
<span class="nuda-chip-remove__chip">
motion
<button class="nuda-chip-remove__x" aria-label="Remove motion">×</button>
</span>
</div>
<script>
document.querySelectorAll(".nuda-chip-remove__x").forEach((btn) => {
btn.addEventListener("click", () => {
const chip = btn.closest(".nuda-chip-remove__chip");
chip.classList.add("nuda-chip-remove__chip--leaving");
chip.addEventListener("animationend", () => chip.remove(), { once: true });
});
});
</script>CSS
/* Chip Remove Animation
Chip shrinks and fades when removed.
Customize: --chip-bg, --chip-radius */
.nuda-chip-remove {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.nuda-chip-remove__chip {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 4px 4px 10px;
font: 500 12px/1 ui-sans-serif, system-ui, sans-serif;
color: #fafafa;
background: #111114;
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 99px;
transform-origin: center;
animation: nuda-chip-in 0.25s ease both;
}
.nuda-chip-remove__chip--leaving {
animation: nuda-chip-out 0.3s ease forwards;
}
.nuda-chip-remove__x {
display: inline-grid;
place-items: center;
width: 18px;
height: 18px;
font-size: 14px;
line-height: 1;
color: #a0a0a8;
background: transparent;
border: 0;
border-radius: 99px;
cursor: pointer;
transition: background 0.15s, color 0.15s;
}
.nuda-chip-remove__x:hover {
background: rgba(255, 255, 255, 0.08);
color: #fafafa;
}
@keyframes nuda-chip-in {
from { opacity: 0; transform: scale(0.6); }
to { opacity: 1; transform: scale(1); }
}
@keyframes nuda-chip-out {
to { opacity: 0; transform: scale(0.6); }
}
@media (prefers-reduced-motion: reduce) {
.nuda-chip-remove__chip,
.nuda-chip-remove__chip--leaving { animation: none; }
}How to use Chip Remove Animation
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.