Overview
The Badge component is used to highlight small bits of information such as status indicators, labels, or tags. It’s built with class-variance-authority for flexible styling variants.Import
Usage
Props
variant
'default' | 'secondary' | 'outline' | 'gold' | 'destructive' | 'select' | 'green' | 'blue' | 'document'
default:"'default'"
Visual style variant of the badge.
Additional CSS classes to apply to the badge.
Content to display inside the badge.
Variants
Default
The default variant uses secondary button styling.Secondary
Secondary variant with background and hover effect.Outline
Outline variant with border only.Gold
Gold variant for premium or trial features.Destructive
Destructive (error) variant with red background.Select
Select variant with border background.Green
Green success variant.Blue
Blue info variant.Document
Document chip variant with rounded corners and specific styling.Examples
Status Indicators
With Icons
Custom Styling
Accessibility
The Badge component renders as a<div> element. For semantic meaning, consider using appropriate ARIA attributes:
Styling Details
The Badge component uses the following base styles:inline-flex items-center- Flexbox layoutrounded-full- Fully rounded corners (except ‘document’ variant)border- Border stylingpx-2.5 py-0.5- Paddingtext-xs- Small text sizeh-fit- Height fits contenttransition-colors- Smooth color transitions
Source
Location:/home/daytona/workspace/source/packages/ui/src/badge/badge.tsx