Badges
Badges are compact elements for labeling, highlighting status, or displaying notifications. They support various sizes, colors, and optional icons to enhance visual communication.
Basic Usage
Badges come in three sizes and multiple colors to match your design system. The default badge uses a neutral color scheme.
Basic Badge Sizes
100%
<div class="flex items-center gap-4">
<byte-badge size="small">Small</byte-badge>
<byte-badge>Medium</byte-badge>
<byte-badge size="large">Large</byte-badge>
</div>
Colors
Choose from a wide range of colors to convey different meanings or match your brand palette. Each color comes with optimized contrast for both light and dark modes.
Badge Colors
100%
<div class="flex flex-wrap gap-2">
<byte-badge color="zinc">Zinc</byte-badge>
<byte-badge color="red">Red</byte-badge>
<byte-badge color="green">Green</byte-badge>
<byte-badge color="blue">Blue</byte-badge>
<byte-badge color="yellow">Yellow</byte-badge>
<byte-badge color="purple">Purple</byte-badge>
<byte-badge color="rose">Rose</byte-badge>
</div>
Icons
Add icons to badges to enhance their meaning or provide visual cues. Icons automatically adjust their size based on the badge size.
Badges with Icons
100%
<div class="flex flex-wrap gap-2">
<byte-badge icon="check-circle" color="green">Completed</byte-badge>
<byte-badge icon="clock" color="yellow">Pending</byte-badge>
<byte-badge icon="x-circle" color="red">Failed</byte-badge>
<byte-badge icon="bell" color="blue">Notification</byte-badge>
</div>
Common Use Cases
Here are some typical scenarios where badges are commonly used:
Badge Use Cases
100%
<div class="space-y-4">
<!-- Status Indicators -->
<div class="flex items-center gap-2">
<byte-badge icon="circle" color="green" size="small">Online</byte-badge>
<span class="text-sm text-zinc-600 dark:text-zinc-400">Status indicators</span>
</div>
<!-- Counters -->
<div class="flex items-center gap-2">
<byte-badge color="red" size="small">99+</byte-badge>
<span class="text-sm text-zinc-600 dark:text-zinc-400">Notification counters</span>
</div>
<!-- Labels -->
<div class="flex items-center gap-2">
<byte-badge color="purple">Premium</byte-badge>
<span class="text-sm text-zinc-600 dark:text-zinc-400">Feature labels</span>
</div>
</div>
API Reference
Properties
string
'medium'
string
'zinc'
string
Available Colors
zinc
red
orange
amber
yellow
lime
green
emerald
teal
cyan
sky
blue
indigo
violet
purple
fuchsia
pink
rose
Size Comparison
Best Practices
- Use consistent sizes within the same context
- Choose colors that have semantic meaning in your application
- Keep badge text concise and clear
- Use icons sparingly and only when they add value
- Consider color contrast for accessibility
Pro tip: Combine badges with other components like buttons or cards to create more complex UI patterns.