Badge
A versatile badge component for displaying status, categories, counts, and other contextual information with various styles and sizes.
<c-badge>Default Badge</c-badge>
Component API
| Property | Type | Default | Description |
|---|---|---|---|
variant |
string |
neutral |
Badge color variant: primary, secondary, accent, success, warning, error, info, neutral, ghost |
size |
string |
md |
Badge size: xs, sm, md, lg |
outline |
string |
false |
Use outline style instead of solid (use "true") |
icon_left |
string |
- |
Icon name to display on the left side |
icon_right |
string |
- |
Icon name to display on the right side |
class |
string |
- |
Additional CSS classes |
Examples
Badge Variants
The badge component supports multiple color variants for different contexts and meanings.
<c-badge variant="primary">Primary</c-badge>
<c-badge variant="secondary">Secondary</c-badge>
<c-badge variant="success">Success</c-badge>
<c-badge variant="warning">Warning</c-badge>
<c-badge variant="error">Error</c-badge>
Badge Sizes
Different sizes are available to match your design needs and hierarchy.
<c-badge variant="primary" size="xs">Extra Small</c-badge>
<c-badge variant="primary" size="sm">Small</c-badge>
<c-badge variant="primary" size="md">Medium</c-badge>
<c-badge variant="primary" size="lg">Large</c-badge>
Outline Style
Use the outline="true" prop for a bordered style instead of solid background.
<c-badge variant="primary" outline="true">Primary</c-badge>
<c-badge variant="secondary" outline="true">Secondary</c-badge>
<c-badge variant="success" outline="true">Success</c-badge>
Badges with Icons
Add icons to your badges using icon_left and icon_right props.
<c-badge variant="success" icon_left="check">Completed</c-badge>
<c-badge variant="warning" icon_left="clock">Pending</c-badge>
<c-badge variant="error" icon_left="x">Failed</c-badge>
<c-badge variant="info" icon_right="arrow-right">Next</c-badge>
Status Indicators
Common usage patterns for status indication in applications.
<c-badge variant="success" size="sm" icon_left="check">Active</c-badge>
<c-badge variant="warning" size="sm" icon_left="clock">Processing</c-badge>
<c-badge variant="error" size="sm" icon_left="alert-triangle">High</c-badge>
Count and Notification Badges
Perfect for displaying counts, notifications, and numeric indicators.
<c-badge variant="primary" size="sm">12</c-badge>
<c-badge variant="error" size="xs">3</c-badge>
<c-badge variant="accent" size="sm">5</c-badge>
<c-badge variant="success" size="xs">•</c-badge>