In this section we will see few tailwind CSS badge examples. badge is use show status, message,notification, inbox etc .
Tailwind CSS Badge Examples
Setup Tailwind CSS
Simple Badge
Button with Badge
Icon with Badge
Setup Tailwind CSS
First you need to install tailwind css on your system or you can use CDN
👉 The Easiest way to install Tailwind CSS with Tailwind CLI
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
Tailwind Simple Badge
<span class="text-xs px-2 py-0.5 font-bold bg-gray-100 text-gray-600 rounded">
Default
</span>
<span class="px-2 py-0.5 text-xs font-bold bg-red-500 text-white rounded">
Danger
</span>
<span class="px-2 py-0.5 text-xs font-bold bg-yellow-300 text-black rounded">
Warning
</span>
<span class="text-xs px-2 py-0.5 rounded font-bold bg-green-500 text-white ">
Success
</span>
<span class="text-xs px-2 font-bold bg-blue-500 text-white rounded py-0.5">
info
</span>
Tailwind Button with Badge
<button type="button" class="px-4 py-2 mr-2 text-white bg-blue-500 rounded">
Button
<span class="px-2 py-1 text-sm text-black bg-white rounded-full">9</span>
</button>
Tailwind Icon with Badge
<span class="relative inline-block">
<svg xmlns="http://www.w3.org/2000/svg" class="w-16 h-16 text-gray-200" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4" />
</svg>
<span
class="absolute top-0 right-0 px-2 py-1 text-xs font-bold leading-none text-red-100 transform bg-red-600 rounded-full">9</span>
</span>
Read Also
Tailwind CSS 3 FAQ Accordion UI Example
Tailwind CSS 3 Alert Message Example
Tailwind CSS 3 Avatars Example
Tailwind CSS 3 Breadcrumb Example
Tailwind CSS Gradient Button Example
Tailwind CSS 3D Button Example
Tailwind CSS Loading Button Example
Tailwind CSS v3 Cards Examples
Tailwind CSS Checkbox Form Examples
Tailwind CSS Dropdowns (Menu) on Hover Example
Tailwind CSS Multiselect Dropdown Example
How to use dark mode toggle switch in Tailwind CSS 3
How to use @apply directive in Tailwind CSS
Tailwind CSS sticky header & fixed navbar example
Tailwind CSS Navbar UI Example
Tailwind CSS 3 Login Page UI Example
Tailwind CSS Login Modal Example
Tailwind CSS 3 Overlay Image Example
Tailwind CSS Thank You Page Example
Tailwind CSS Timeline UI Example
Tailwind CSS Responsive Footer Section Example
Tailwind CSS Background Image Header Example