Import
Basic Usage
Props
BadgeVariant
default:"default"
Badge style variant that determines the visual appearanceAvailable variants:
default- Primary color badgesuccess- Green background, white textwarning- Yellow background, white texterror- Red/destructive background, white textneutral- Secondary color badgeoutline-success- Outlined with green status dotoutline-warning- Outlined with orange status dotoutline-error- Outlined with red status dotoutline-info- Outlined with blue status dotoutline-neutral- Outlined with neutral status dot
React.ReactNode
required
Badge content (typically text)
string
Additional CSS classes for custom styling
Variant Examples
Solid Variants
Solid badges have colored backgrounds with contrasting text:Outline Variants
Outline badges have a border and include a colored status dot:Common Use Cases
Order Status
User Role Tags
Payment Status
Integration with DescriptionCard
Badges work seamlessly with the DescriptionCard component for status fields:TypeScript
The component exports its prop types for TypeScript usage:Accessibility
The Badge component:- Uses semantic HTML with proper color contrast ratios
- Includes focus states for interactive use cases
- Supports all standard HTML div attributes