Badge Combined
<section class="max-w-5xl mx-auto p-8">
<h1 class="text-3xl font-bold text-center mb-10">Badge Component Showcase</h1>
<div class="grid grid-cols-1 md:grid-cols-2 gap-10">
<!-- Basic Badges -->
<div class="bg-white p-6 rounded-lg shadow-md">
<h2 class="text-xl font-semibold mb-4">Basic Badges</h2>
<div class="flex flex-wrap gap-2 items-center">
<span class="badge">Default</span>
<span class="badge badge-primary">Primary</span>
<span class="badge badge-secondary">Secondary</span>
<span class="badge badge-accent">Accent</span>
<span class="badge badge-neutral">Neutral</span>
</div>
</div>
<!-- Badge Sizes -->
<div class="bg-white p-6 rounded-lg shadow-md">
<h2 class="text-xl font-semibold mb-4">Badge Sizes</h2>
<div class="flex flex-wrap gap-2 items-center">
<span class="badge badge-xs">Xsmall</span>
<span class="badge badge-sm">Small</span>
<span class="badge badge-md">Medium</span>
<span class="badge badge-lg">Large</span>
<span class="badge badge-xl">Xlarge</span>
</div>
</div>
<!-- Status Badges -->
<div class="bg-white p-6 rounded-lg shadow-md">
<h2 class="text-xl font-semibold mb-4">Status Badges</h2>
<div class="flex flex-wrap gap-2 items-center">
<span class="badge badge-info">Info</span>
<span class="badge badge-success">Success</span>
<span class="badge badge-warning">Warning</span>
<span class="badge badge-error">Error</span>
</div>
</div>
<!-- Outline Badges -->
<div class="bg-white p-6 rounded-lg shadow-md">
<h2 class="text-xl font-semibold mb-4">Outline Badges</h2>
<div class="flex flex-wrap gap-2 items-center">
<span class="badge badge-outline badge-primary">Primary</span>
<span class="badge badge-outline badge-secondary">Secondary</span>
<span class="badge badge-outline badge-info">Info</span>
<span class="badge badge-outline badge-success">Success</span>
</div>
</div>
<!-- Soft Badges -->
<div class="bg-white p-6 rounded-lg shadow-md">
<h2 class="text-xl font-semibold mb-4">Soft Badges</h2>
<div class="flex flex-wrap gap-2 items-center">
<span class="badge badge-soft badge-primary">Primary</span>
<span class="badge badge-soft badge-secondary">Secondary</span>
<span class="badge badge-soft badge-info">Info</span>
<span class="badge badge-soft badge-success">Success</span>
</div>
</div>
<!-- Badges with Icons -->
<div class="bg-white p-6 rounded-lg shadow-md">
<h2 class="text-xl font-semibold mb-4">Badges with Icons</h2>
<div class="flex flex-wrap gap-2 items-center">
<div class="badge badge-info">
<svg class="w-4 h-4 mr-1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<line x1="12" y1="16" x2="12" y2="12"></line>
<line x1="12" y1="8" x2="12.01" y2="8"></line>
</svg>
Info
</div>
<div class="badge badge-success">
<svg class="w-4 h-4 mr-1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path>
<polyline points="22 4 12 14.01 9 11.01"></polyline>
</svg>
Success
</div>
</div>
</div>
<!-- Badge in Text -->
<div class="bg-white p-6 rounded-lg shadow-md col-span-full">
<h2 class="text-xl font-semibold mb-4">Badges in Context</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<h3 class="text-lg font-medium mb-3">In Text</h3>
<h2 class="text-lg font-semibold mb-2">
Project Status <span class="badge badge-success">Active</span>
</h2>
<p class="text-base mb-2">
New feature release <span class="badge badge-sm badge-info">v2.0.1</span>
</p>
</div>
<div>
<h3 class="text-lg font-medium mb-3">In Buttons</h3>
<div class="flex flex-wrap gap-2">
<button class="btn">
Inbox <div class="badge badge-sm ml-2">+99</div>
</button>
<button class="btn btn-primary">
Messages <div class="badge badge-sm badge-accent ml-2">+12</div>
</button>
</div>
</div>
</div>
</div>
</div>
</section>
<style>
.badge {
display: inline-flex;
align-items: center;
justify-content: center;
transition-property: color, background-color, border-color;
transition-duration: 200ms;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
width: fit-content;
border-radius: 0.375rem;
background-color: #e5e7eb;
color: #374151;
}
/* Badge sizes */
.badge-xs {
height: 1rem;
font-size: 0.75rem;
line-height: 1rem;
padding-left: 0.438rem;
padding-right: 0.438rem;
}
.badge-sm {
height: 1.25rem;
font-size: 0.75rem;
line-height: 1rem;
padding-left: 0.5rem;
padding-right: 0.5rem;
}
.badge-md {
height: 1.5rem;
font-size: 0.875rem;
line-height: 1.25rem;
padding-left: 0.563rem;
padding-right: 0.563rem;
}
.badge-lg {
height: 1.75rem;
font-size: 1rem;
line-height: 1.5rem;
padding-left: 0.75rem;
padding-right: 0.75rem;
}
.badge-xl {
height: 2.25rem;
font-size: 1.125rem;
line-height: 1.75rem;
padding-left: 1rem;
padding-right: 1rem;
}
/* Badge colors */
.badge-primary {
background-color: #3b82f6;
color: white;
}
.badge-secondary {
background-color: #8b5cf6;
color: white;
}
.badge-accent {
background-color: #f472b6;
color: white;
}
.badge-neutral {
background-color: #6b7280;
color: white;
}
.badge-info {
background-color: #3abff8;
color: white;
}
.badge-success {
background-color: #36d399;
color: white;
}
.badge-warning {
background-color: #fbbd23;
color: white;
}
.badge-error {
background-color: #f87272;
color: white;
}
/* Soft style */
.badge-soft.badge-primary {
background-color: rgba(59, 130, 246, 0.1);
color: #3b82f6;
}
.badge-soft.badge-secondary {
background-color: rgba(139, 92, 246, 0.1);
color: #8b5cf6;
}
.badge-soft.badge-info {
background-color: rgba(58, 191, 248, 0.1);
color: #3abff8;
}
.badge-soft.badge-success {
background-color: rgba(54, 211, 153, 0.1);
color: #36d399;
}
/* Outline style */
.badge-outline {
background-color: transparent;
border-width: 1px;
border-style: solid;
border-color: currentColor;
}
.badge-outline.badge-primary {
background-color: transparent;
color: #3b82f6;
border-color: #3b82f6;
}
.badge-outline.badge-secondary {
background-color: transparent;
color: #8b5cf6;
border-color: #8b5cf6;
}
.badge-outline.badge-info {
background-color: transparent;
color: #3abff8;
border-color: #3abff8;
}
.badge-outline.badge-success {
background-color: transparent;
color: #36d399;
border-color: #36d399;
}
/* Button styles */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0.5rem 1rem;
font-size: 0.875rem;
line-height: 1.25rem;
font-weight: 500;
text-align: center;
border-radius: 0.375rem;
cursor: pointer;
transition-property: color, background-color, border-color;
transition-duration: 200ms;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
background-color: #e5e7eb;
color: #374151;
height: 2.5rem;
min-height: 2.5rem;
border: 1px solid transparent;
}
.btn-primary {
background-color: #3b82f6;
color: white;
}
.ml-2 {
margin-left: 0.5rem;
}
</style>
Copied to clipboard