A flexible React component for displaying a status or label with a colored dot. Easily customize its color, text, and style to fit nearly any UI—great for status indicators, tags, notifications, or compact labels.
Inspired by composable badge components commonly seen in modern design systems.
You can install the Badge component with the following CLI command, or copy the implementation manually:
1npx shadcn@latest add http://localhost:3000/r/badge.jsonTo use the Badge component, import it in your code:
1import Badge from '@/components/Badge';The Badge component accepts the following props:
| Prop | Type | Default | Description | Required |
|---|---|---|---|---|
label | string | - | The text to display inside the badge. | Yes |
variant | 'green' | 'cyan' | 'red' | 'blue' | 'yellow' | 'purple' | 'green' | The color theme for the badge. | No |
className | string | - | Additional utility classes for fine-tuning the badge. | No |
1<Badge label="Active" />1<Badge label="Error" variant="red" />1<Badge label="VIP" variant="purple" className="font-semibold" />The badge comes in six variants: green, cyan, red, blue, yellow, and purple.
This lets you easily match the badge color to specific meanings or UI accents.
1<>
2 <Badge label="Green" variant="green" />
3 <Badge label="Cyan" variant="cyan" className="ml-2" />
4 <Badge label="Red" variant="red" className="ml-2" />
5 <Badge label="Blue" variant="blue" className="ml-2" />
6 <Badge label="Yellow" variant="yellow" className="ml-2" />
7 <Badge label="Purple" variant="purple" className="ml-2" />
8</>green, cyan, red, blue, yellow, or purpledotBgByVariant inside the Badge componentclassName prop for padding, font, or sizingbadgeVariants color map for custom brands or context codesvariant and class assignments.