Badge Components

Tailwind CSS Badge

# Simple

Live

Code

1<span class="whitespace-nowrap rounded-full bg-purple-100 px-2.5 py-0.5 text-sm text-purple-700">
2    Live
3  </span>

# Simple with Icon

Euro

Code

1<span
2  class="inline-flex items-center justify-center rounded-full bg-purple-100 px-2.5 py-0.5 text-purple-700"
3>
4  <svg
5    xmlns="http://www.w3.org/2000/svg"
6    fill="none"
7    viewBox="0 0 24 24"
8    stroke-width="1.5"
9    stroke="currentColor"
10    class="-ms-1 me-1.5 h-4 w-4"
11  >
12    <path
13      stroke-linecap="round"
14      stroke-linejoin="round"
15      d="M14.25 7.756a4.5 4.5 0 100 8.488M7.5 10.5h5.25m-5.25 3h5.25M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
16    />
17  </svg>
18
19  <p class="whitespace-nowrap text-sm">Euro</p>
20</span>

# Simple Icon Only

Icon description Icon description Icon description Icon description

Code

1<span class="inline-flex items-center justify-center w-6 h-6 me-2 text-sm font-semibold text-gray-800 bg-gray-100 rounded-full ">
2        <svg class="w-2.5 h-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 16 12">
3            <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 5.917 5.724 10.5 15 1.5" />
4        </svg>
5        <span class="sr-only">Icon description</span>
6    </span>
7    <span class="inline-flex items-center justify-center w-6 h-6 me-2 text-sm font-semibold text-blue-800 bg-blue-100 rounded-full ">
8        <svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
9            <path fill="currentColor" d="m18.774 8.245-.892-.893a1.5 1.5 0 0 1-.437-1.052V5.036a2.484 2.484 0 0 0-2.48-2.48H13.7a1.5 1.5 0 0 1-1.052-.438l-.893-.892a2.484 2.484 0 0 0-3.51 0l-.893.892a1.5 1.5 0 0 1-1.052.437H5.036a2.484 2.484 0 0 0-2.48 2.481V6.3a1.5 1.5 0 0 1-.438 1.052l-.892.893a2.484 2.484 0 0 0 0 3.51l.892.893a1.5 1.5 0 0 1 .437 1.052v1.264a2.484 2.484 0 0 0 2.481 2.481H6.3a1.5 1.5 0 0 1 1.052.437l.893.892a2.484 2.484 0 0 0 3.51 0l.893-.892a1.5 1.5 0 0 1 1.052-.437h1.264a2.484 2.484 0 0 0 2.481-2.48V13.7a1.5 1.5 0 0 1 .437-1.052l.892-.893a2.484 2.484 0 0 0 0-3.51Z" />
10            <path fill="#fff" d="M8 13a1 1 0 0 1-.707-.293l-2-2a1 1 0 1 1 1.414-1.414l1.42 1.42 5.318-3.545a1 1 0 0 1 1.11 1.664l-6 4A1 1 0 0 1 8 13Z" />
11        </svg>
12        <span class="sr-only">Icon description</span>
13    </span>
14    <span class="inline-flex items-center justify-center w-6 h-6 me-2 text-sm font-semibold text-gray-800 bg-gray-100 rounded-full ">
15        <svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
16            <path d="M10 0a10 10 0 1 0 10 10A10.011 10.011 0 0 0 10 0Zm0 5a3 3 0 1 1 0 6 3 3 0 0 1 0-6Zm0 13a8.949 8.949 0 0 1-4.951-1.488A3.987 3.987 0 0 1 9 13h2a3.987 3.987 0 0 1 3.951 3.512A8.949 8.949 0 0 1 10 18Z" />
17        </svg>
18        <span class="sr-only">Icon description</span>
19    </span>
20    <span class="inline-flex items-center justify-center w-6 h-6 me-2 text-sm font-semibold text-blue-800 bg-blue-100 rounded-full ">
21        <svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
22            <path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z" />
23        </svg>
24        <span class="sr-only">Icon description</span>
25    </span>

# Themed

Paid

Refunded

Failed

Code

1<!-- Success -->
2<span
3  class="inline-flex items-center justify-center rounded-full bg-emerald-100 px-2.5 py-0.5 text-emerald-700"
4>
5  <svg
6    xmlns="http://www.w3.org/2000/svg"
7    fill="none"
8    viewBox="0 0 24 24"
9    stroke-width="1.5"
10    stroke="currentColor"
11    class="-ms-1 me-1.5 h-4 w-4"
12  >
13    <path
14      stroke-linecap="round"
15      stroke-linejoin="round"
16      d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
17    />
18  </svg>
19
20  <p class="whitespace-nowrap text-sm">Paid</p>
21</span>
22
23<!-- Warning -->
24<span
25  class="inline-flex items-center justify-center rounded-full bg-amber-100 px-2.5 py-0.5 text-amber-700"
26>
27  <svg
28    xmlns="http://www.w3.org/2000/svg"
29    fill="none"
30    viewBox="0 0 24 24"
31    stroke-width="1.5"
32    stroke="currentColor"
33    class="-ms-1 me-1.5 h-4 w-4"
34  >
35    <path
36      stroke-linecap="round"
37      stroke-linejoin="round"
38      d="M8.25 9.75h4.875a2.625 2.625 0 010 5.25H12M8.25 9.75L10.5 7.5M8.25 9.75L10.5 12m9-7.243V21.75l-3.75-1.5-3.75 1.5-3.75-1.5-3.75 1.5V4.757c0-1.108.806-2.057 1.907-2.185a48.507 48.507 0 0111.186 0c1.1.128 1.907 1.077 1.907 2.185z"
39    />
40  </svg>
41
42  <p class="whitespace-nowrap text-sm">Refunded</p>
43</span>
44
45<!-- Error -->
46<span
47  class="inline-flex items-center justify-center rounded-full bg-red-100 px-2.5 py-0.5 text-red-700"
48>
49  <svg
50    xmlns="http://www.w3.org/2000/svg"
51    fill="none"
52    viewBox="0 0 24 24"
53    stroke-width="1.5"
54    stroke="currentColor"
55    class="-ms-1 me-1.5 h-4 w-4"
56  >
57    <path
58      stroke-linecap="round"
59      stroke-linejoin="round"
60      d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"
61    />
62  </svg>
63
64  <p class="whitespace-nowrap text-sm">Failed</p>
65</span>

# Close

Euro

Code

1<span
2    class="inline-flex items-center justify-center rounded-full bg-purple-100 px-2.5 py-0.5 text-purple-700"
3  >
4    <p class="whitespace-nowrap text-sm">Euro</p>
5  
6    <button
7      class="-me-1 ms-1.5 inline-block rounded-full bg-purple-200 p-0.5 text-purple-700 transition hover:bg-purple-300"
8    >
9      <span class="sr-only">Remove badge</span>
10  
11      <svg
12        xmlns="http://www.w3.org/2000/svg"
13        fill="none"
14        viewBox="0 0 24 24"
15        stroke-width="1.5"
16        stroke="currentColor"
17        class="h-3 w-3"
18      >
19        <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
20      </svg>
21    </button>
22  </span>

# Default

Default Dark Red Green Yellow Indigo Purple Pink

Code

1<span class="bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded ">Default</span>
2<span class="bg-gray-100 text-gray-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded ">Dark</span>
3<span class="bg-red-100 text-red-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded">Red</span>
4<span class="bg-green-100 text-green-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded ">Green</span>
5<span class="bg-yellow-100 text-yellow-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded">Yellow</span>
6<span class="bg-indigo-100 text-indigo-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded">Indigo</span>
7<span class="bg-purple-100 text-purple-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded">Purple</span>
8<span class="bg-pink-100 text-pink-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded ">Pink</span>

# Large badges

Default Dark Red Green Yellow Indigo Purple Pink

Code

1<span class="bg-blue-100 text-blue-800 text-sm font-medium me-2 px-2.5 py-0.5 rounded ">Default</span>
2<span class="bg-gray-100 text-gray-800 text-sm font-medium me-2 px-2.5 py-0.5 rounded ">Dark</span>
3<span class="bg-red-100 text-red-800 text-sm font-medium me-2 px-2.5 py-0.5 rounded">Red</span>
4<span class="bg-green-100 text-green-800 text-sm font-medium me-2 px-2.5 py-0.5 rounded ">Green</span>
5<span class="bg-yellow-100 text-yellow-800 text-sm font-medium me-2 px-2.5 py-0.5 rounded ">Yellow</span>
6<span class="bg-indigo-100 text-indigo-800 text-sm font-medium me-2 px-2.5 py-0.5 rounded ">Indigo</span>
7<span class="bg-purple-100 text-purple-800 text-sm font-medium me-2 px-2.5 py-0.5 rounded ">Purple</span>
8<span class="bg-pink-100 text-pink-800 text-sm font-medium me-2 px-2.5 py-0.5 rounded ">Pink</span>

# Bordered badge

Default Dark Red Green Yellow Indigo Purple Pink

Code

1<span class="bg-blue-100 text-blue-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded  border border-blue-400">Default</span>
2<span class="bg-gray-100 text-gray-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded  border border-gray-500">Dark</span>
3<span class="bg-red-100 text-red-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded  border border-red-400">Red</span>
4<span class="bg-green-100 text-green-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded  border border-green-400">Green</span>
5<span class="bg-yellow-100 text-yellow-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded  border border-yellow-300">Yellow</span>
6<span class="bg-indigo-100 text-indigo-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded  border border-indigo-400">Indigo</span>
7<span class="bg-purple-100 text-purple-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded  border border-purple-400">Purple</span>
8<span class="bg-pink-100 text-pink-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded  border border-pink-400">Pink</span>

# Badges as links

Code

1<a href="#" class="bg-blue-100 hover:bg-blue-200 text-blue-800 text-xs font-semibold me-2 px-2.5 py-0.5 rounded  border border-blue-400 inline-flex items-center justify-center">Badge link</a>
2<a href="#" class="bg-blue-100 hover:bg-blue-200 text-blue-800 text-sm font-medium me-2 px-2.5 py-0.5 rounded  border border-blue-400 inline-flex items-center justify-center">Badge link</a>

# Notification badge

Code

1<button type="button" class="relative inline-flex items-center p-3 text-sm font-medium text-center text-white bg-blue-500 rounded-lg hover:bg-blue-600 focus:ring-4 focus:outline-none focus:ring-blue-300 ">
2<svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 16">
3<path d="m10.036 8.278 9.258-7.79A1.979 1.979 0 0 0 18 0H2A1.987 1.987 0 0 0 .641.541l9.395 7.737Z"/>
4<path d="M11.241 9.817c-.36.275-.801.425-1.255.427-.428 0-.845-.138-1.187-.395L0 2.6V14a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V2.5l-8.759 7.317Z"/>
5</svg>
6<span class="sr-only">Notifications</span>
7  <div class="absolute inline-flex items-center justify-center w-6 h-6 text-xs font-bold text-white bg-red-500 border-2 border-white rounded-full -top-2 -end-2 ">20</div>
8</button>

# Button with badge

Code

1<button type="button" class="inline-flex items-center px-5 py-2.5 text-sm font-medium text-center text-white bg-blue-500 rounded-lg hover:bg-blue-600 focus:ring-4 focus:outline-none focus:ring-blue-300 ">
2    Messages
3    <span class="inline-flex items-center justify-center w-4 h-4 ms-2 text-xs font-semibold text-blue-600 bg-blue-200 rounded-full">2</span>
4    </button>