Skip to content

Badges and Tags Collection

Dark Tailwind CSS badge collection: color pills, status dots, notification counters, icon badges and removable tags with an add-tag input.

Also known as: badge collection, status badges, tag pills, notification badge, removable tags

Tailwind CSS Badges Responsive Dark #badge #dark #label #status #tags

Badges and Tags Collection live demo

Open in new tab

Tailwind CSS code (HTML, CSS, JS)

A dark-themed collection of badges and tags built with Tailwind CSS: soft color labels, solid and outline micro badges, status badges with a dot, notification counters on icon buttons, badges with inline SVG icons and an editable list of removable tags. Drop the pieces you need into dashboards, issue trackers, admin panels or blog post headers.

How it works

The root is .tbc-root, a slate-950 section with four cards in a grid that stacks on phones and becomes two columns from md. The static badges are plain span elements styled only with utilities: a translucent background such as bg-sky-400/10, a matching text-sky-300 and an inset ring (ring-1 ring-inset ring-sky-400/30) for the soft style. Status badges add a small rounded-full dot, and the "Deploying" badge stacks a second dot with the .tbc-ping animation from style.css. Counters are absolutely positioned on relative icon buttons and carry ring-2 ring-slate-900 so they cut out of the button edge. The gradient "Featured" badge uses .tbc-shine for a light sweep.

The removable tags live in the card marked data-tbc-tags. On DOMContentLoaded the script keeps a copy of the first .tbc-tag as a blueprint. Clicking a data-tbc-remove button deletes that tag and moves focus to the next tag, the previous one, or the input. Submitting data-tbc-form normalizes the text (lowercase, spaces to hyphens), rejects empty and duplicate names, enforces the limit, and appends a new tag with the .tbc-tag--new entrance animation. Backspace in an empty input removes the last tag. data-tbc-count always shows the current number of tags.

Customization

  • data-tbc-max="8" on data-tbc-form: raise or lower the maximum number of tags.
  • maxlength="24" on #tbc-new-tag: limit how long a single tag may be.
  • Swap indigo for another color in .tbc-tag classes (bg-indigo-500/15, text-indigo-200, ring-indigo-400/30) to restyle all tags; new tags copy the first one, so only the first needs to change.
  • Turn a soft badge solid by replacing bg-emerald-400/10 text-emerald-300 with bg-emerald-500 text-emerald-950.
  • rounded-full vs rounded-md on any badge switches between pill and square shapes.
  • animation: tbc-ping 1.4s in style.css: slow down the deploy pulse or remove .tbc-ping for a static dot.
  • For a light page, replace bg-slate-950 on .tbc-root and use -50 backgrounds with -700 text on the badges.

Use cases

  • Dashboards: color pills and status dots show states such as active or pending at a glance
  • Issue trackers: label tickets with soft color badges and an editable list of removable tags
  • Admin panels: notification counters on icon buttons flag unread items
  • Blog post headers: small category and outline badges sit above titles

Accessibility

Decorative dots and icons are aria-hidden, so each badge is read by its text alone. Counter buttons hide the visual number and expose a full label such as "Notifications, 3 unread" through sr-only text. Every remove button has an aria-label naming its tag, the input has a label, and adds, removals and errors are announced through the role="status" region data-tbc-status. All controls show a visible focus-visible outline, and every animation stops under prefers-reduced-motion: reduce.

Usage notes

Keep at least one .tbc-tag in the markup, because new tags are cloned from it. Several data-tbc-tags boxes can share a page; give each input its own id. Send the tag list to your server with fetch() in the submit handler if it must persist.

Badges and Tags Collection at a glance

Framework
Tailwind CSS
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Tailwind CSS
Layout
Responsive, works on mobile, dark design
Category
Badges
License
Free for personal and commercial use

Questions about this template

Can I use the Badges and Tags Collection code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Tailwind CSS from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>

The Tailwind browser build is for prototyping. In production, compile Tailwind with its CLI or your bundler.

Badges and Tags Collection – free Tailwind CSS badge template
Badges and Tags Collection · free Tailwind CSS badge template

More Badges

Notification Dot and Count Badges – free Pure CSS badge template

Notification Dot and Count Badges

Pure CSS notification badges: count bubbles, 99+ pills, pulsing dots and status dots positioned on icon buttons, avatars and text buttons.

Dismissible Filter Chips – free Bootstrap 5 badge template

Dismissible Filter Chips

Bootstrap 5 active filter bar with removable chips, Clear all button, undo for recently removed filters and live result count.