Badge
Badges highlight status, labels, or counts in a compact visual format.
Component variations
Variant
Contains: Solid, Subtle, Solid is default
Size
Contains: Small as sm, medium as md, large as lg. Medium is default
Colors
Contains: Primary, Neutral, Error, Success, Info, Warning. Primary is default
Roundness
Is a boolean value. True makes the badge fully rounded. Otherwise the default roundness will be applied.
Usage Guidelines
Import
Import the badge component in your module or component:
import-badge.ts
Copy code
Basic Implementation
Here is a basic example of using the badge component:
badge-example.html
Copy code
Implementation with all available APIs
Here is an example of using the badge component with all available APIs:
badge-example.html
Copy code
API Reference
Inputs
Property | Type | Default | Required | Description |
|---|---|---|---|---|
string | - | Yes | Text displayed inside the badge | |
'solid' | 'subtle' | 'solid' | No | Visual style of the badge | |
'primary' | 'neutral' | 'error' | 'success' | 'info' | 'warning' | 'primary' | No | Color token for the badge | |
'sm' | 'md' | 'md' | No | Size of the badge | |
boolean | false | No | Whether the badge has fully rounded corners |
Best Practices
When to Use
- Use Badge when this pattern clearly supports the user task.
- Use it to keep similar interactions consistent across the product.
When Not to Use
- Avoid using Badge when a simpler component communicates the same intent.
- Avoid using it when the pattern introduces unnecessary interaction steps.
Design Guidelines
- Use concise labels to keep badges readable
- Choose subtle variant for secondary emphasis; solid for primary emphasis
- Prefer neutral color for generic counts; use semantic colors for status
- Avoid mixing too many badge sizes in the same view
- Use rounded when pairing with pills or tag-like UI
- Keep labels, helper text, and actions concise and easy to scan.
- Use VD variants and states consistently for predictable behavior.
- Ensure keyboard access and clear focus order for accessibility.
Component playground
example.html
Copy code