Chip Input Add
A copy-paste tags & chips input component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.
Tags & Chips InputHTMLCSSany framework
reacttypescriptcss
Copy into your project
HTML
<div class="nuda-chip-input">
<span class="nuda-chip-input__chip">react</span>
<span class="nuda-chip-input__chip">typescript</span>
<span class="nuda-chip-input__chip">css</span>
<input class="nuda-chip-input__field" placeholder="Add tag…" />
</div>
<script>
// Press Enter to add the typed value as a new chip.
document.querySelector(".nuda-chip-input__field")
.addEventListener("keydown", (e) => {
if (e.key !== "Enter" || !e.target.value.trim()) return;
e.preventDefault();
const chip = document.createElement("span");
chip.className = "nuda-chip-input__chip";
chip.textContent = e.target.value.trim();
e.target.before(chip);
e.target.value = "";
});
</script>CSS
/* Chip Input Add
Typed text becomes a chip on Enter.
Customize: --chip-bg, --chip-accent */
.nuda-chip-input {
--chip-accent: #e4ff54;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px;
width: 100%;
padding: 8px;
background: #0c0c10;
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 10px;
transition: border-color 0.2s ease;
}
.nuda-chip-input:focus-within {
border-color: var(--chip-accent);
}
.nuda-chip-input__chip {
display: inline-flex;
align-items: center;
padding: 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.06);
border-radius: 99px;
}
.nuda-chip-input__field {
flex: 1;
min-width: 80px;
padding: 4px 6px;
font: 500 12px/1 ui-sans-serif, system-ui, sans-serif;
color: #fafafa;
background: transparent;
border: 0;
outline: 0;
}
.nuda-chip-input__field::placeholder {
color: #63636e;
}How to use Chip Input Add
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.