.badge class to create inline labels, tags, or status indicators. Badges come with six built-in variants for different semantic purposes.
Variants
Variant Styles
Default
Primary background with primary foreground color. Use for primary actions or default states.
Secondary
Secondary background with secondary foreground color. Use for secondary information or alternative states.
Outline
Transparent background with border. Use for neutral or less prominent badges.
Success
Green color scheme. Use for success states, active status, or positive indicators.
Warning
Yellow/orange color scheme. Use for warnings, pending states, or caution indicators.
Danger
Red color scheme. Use for errors, inactive status, or critical alerts.
With Icons
Badges have built-in gap spacing for icons or other inline elements:In Tables
Badges work great for status columns in tables:Styling Details
Layout & Spacing
Layout & Spacing
- Display: inline-flex with centered alignment
- Gap:
var(--space-1)between children - Padding:
var(--space-1)vertical,var(--space-4)horizontal - Border radius: fully rounded (
var(--radius-full))
Typography
Typography
- Font size:
var(--text-8)(small) - Font weight: medium (
var(--font-medium)) - Line height: normal
Color Variants
Color Variants
- Default: Uses
--primaryand--primary-foreground - Secondary: Uses
--secondaryand--secondary-foreground - Outline: Transparent background with
--borderborder - Success/Warning/Danger: Uses color mixing with theme-aware transparency (10% in light mode, 30% in dark mode)
Theme Support
The success, warning, and danger variants automatically adjust their opacity based on light/dark mode:- Light mode: 10% color mix for subtle backgrounds
- Dark mode: 30% color mix for better visibility
CSS Variables
--space-1,--space-4- Spacing--text-8- Font size--font-medium- Font weight--radius-full- Border radius--primary,--primary-foreground- Default colors--secondary,--secondary-foreground- Secondary colors--foreground,--border- Outline colors--success,--warning,--danger- Semantic colors