Basic Usage
Variants
Badges come in 2 visual styles:The visual style variant. Solid has a filled background, Soft has a subtle background.
Sizes
The size of the badge
Colors
Badges support 47 color options from the Radix color palette:Badge color theme. Available colors include: primary, secondary, info, success, warning, destructive, gray, mauve, slate, sage, olive, sand, tomato, red, ruby, crimson, pink, plum, purple, violet, iris, indigo, blue, cyan, teal, jade, green, grass, brown, orange, sky, mint, lime, yellow, amber, gold, bronze.
With Icons
Common Patterns
Status Indicators
Count Badges
Props Reference
Additional CSS classes for styling
Styling
From source code atreflex_ui/components/base/badge.py:52-62:
- Base classes include flex layout and icon sizing
- Size variants control padding, height, border radius, and font size
- Light colors (sky, mint, lime, yellow, amber, secondary) use dark text on solid backgrounds for better contrast
- Color classes are dynamically generated based on variant and color
Implementation Details
From source code atreflex_ui/components/base/badge.py:85-112:
- Extends Reflex’s
Spanelement - Automatically generates color-specific classes
- Validates and applies size, variant, and color at creation time
- Supports all standard HTML span attributes