Skip to content\n\n/* CSS */\n/* Chip Input Add\n Typed text becomes a chip on Enter.\n Customize: --chip-bg, --chip-accent */\n\n.nuda-chip-input {\n --chip-accent: #e4ff54;\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 6px;\n width: 100%;\n padding: 8px;\n background: #0c0c10;\n border: 1px solid rgba(255, 255, 255, 0.08);\n border-radius: 10px;\n transition: border-color 0.2s ease;\n}\n\n.nuda-chip-input:focus-within {\n border-color: var(--chip-accent);\n}\n\n.nuda-chip-input__chip {\n display: inline-flex;\n align-items: center;\n padding: 4px 10px;\n font: 500 12px/1 ui-sans-serif, system-ui, sans-serif;\n color: #fafafa;\n background: #111114;\n border: 1px solid rgba(255, 255, 255, 0.06);\n border-radius: 99px;\n}\n\n.nuda-chip-input__field {\n flex: 1;\n min-width: 80px;\n padding: 4px 6px;\n font: 500 12px/1 ui-sans-serif, system-ui, sans-serif;\n color: #fafafa;\n background: transparent;\n border: 0;\n outline: 0;\n}\n\n.nuda-chip-input__field::placeholder {\n color: #63636e;\n}","license":"https://opensource.org/licenses/MIT","codeRepository":"https://github.com/sgomez-dev/nudaui","isPartOf":{"@id":"https://nudaui.dev/#software"},"isAccessibleForFree":true,"inLanguage":"en","author":{"@id":"https://nudaui.dev/#founder"},"creator":{"@id":"https://nudaui.dev/#founder"},"copyrightHolder":{"@id":"https://nudaui.dev/#founder"},"keywords":"Tags & Chips Input, Chip Input Add, copy paste, css animation, ui component, framework agnostic"},{"@type":"Person","@id":"https://nudaui.dev/#founder","name":"Santiago Gómez de la Torre Romero","givenName":"Santiago","familyName":"Gómez de la Torre Romero","url":"https://sgomez.dev","jobTitle":"Software Engineer","description":"Creator, owner, and maintainer of NudaUI.","sameAs":["https://sgomez.dev","https://blog.sgomez.dev","https://github.com/sgomez-dev","https://linkedin.com/in/sgomez-dev","https://www.npmjs.com/package/sgomez-cli"]}]}

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.

More tags & chips input components

← Browse all NudaUI components