Badge and Tag Components
Design small pill-shaped badges for status indicators, category tags, and notification counts with color-coded backgrounds.
What Are Badges and Tags
Badges are small, compact visual labels that communicate status, counts, or categories at a glance. Tags are typically user-applied labels for filtering and classification, while status badges indicate state like Active, Pending, or Archived.
In Tailwind, both are built with the same core structure: a small amount of padding, a rounded-full or rounded-md border radius, a background color, and small text. The entire component requires zero custom CSS.
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium
bg-green-100 text-green-800">
Active
</span>Pill-Shaped Status Badges
Pill badges use rounded-full for fully rounded ends, which gives them a distinctive shape that stands out from rectangular content. The standard approach pairs a light background tint with a darker text shade from the same color family.
For example, bg-green-100 text-green-800 creates a soft green badge that reads clearly at small sizes. Use px-2.5 py-0.5 for compact padding and text-xs font-medium for a readable label.
<!-- Different status badges -->
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">Active</span>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">Pending</span>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800">Rejected</span>
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-600">Archived</span>All lessons in this course
- Button Variants and States
- Card Component Patterns
- Badge and Tag Components
- Combining Components in a UI