npx shadcn@4.23.1 add @goop/meadow-badgeBadge
FreeA small label with a word, an icon or a count, for a status, a tag, a date or a count beside a title or in a row, for React and Tailwind CSS. Free, MIT.
What an agent sees
- BadgeIconThe badge's leading icon
- BadgeLabelThe badge's words, after an optional BadgeIcon and before an optional BadgeValue
- BadgeValueThe badge's count (
<BadgeValue>{unread}</BadgeValue>, after its words or alone)
import { Badge, BadgeIcon, BadgeLabel, BadgeValue } from '@/components/ui/goop/badge';
function TaskStatuses() {
return (
<div className="flex flex-wrap items-center gap-2">
<Badge variant="plain">
<BadgeLabel>Nov 30</BadgeLabel>
</Badge>
<Badge variant="success">
<BadgeIcon icon="circle-check" />
<BadgeLabel>Done</BadgeLabel>
</Badge>
<Badge variant="warning">
<BadgeIcon icon="triangle-alert" />
<BadgeLabel>Due soon</BadgeLabel>
</Badge>
<Badge variant="overdue">Dec 1</Badge>
<Badge variant="flag">Dec 4</Badge>
<Badge variant="tag">Note</Badge>
<Badge>
<BadgeLabel>Inbox</BadgeLabel>
<BadgeValue>12</BadgeValue>
</Badge>
</div>
);
}
function PlanMarks() {
return (
<div className="flex flex-wrap items-center gap-2">
<Badge solid>Trial</Badge>
<Badge solid variant="success">
Two months free
</Badge>
<Badge solid variant="outline">
Preview
</Badge>
</div>
);
}Switch the variant (each status with its icon), change the words, add a count and change it to see only its changed digits move. Nothing is saved: the badge is drawn live from the panel.
When to use
- A small label with a word, an icon or a count, for a status, a tag, a date or a count beside a title or in a row.
- Also called: tag, chip or pill.
Installation
Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Badge on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.
npx shadcn@4.23.1 add @goop/meadow-badgeAdd the Goop Badge to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { Badge, BadgeIcon, BadgeLabel, BadgeValue } from '@/components/ui/goop/badge';
function TaskStatuses() {
return (
<div className="flex flex-wrap items-center gap-2">
<Badge variant="plain">
<BadgeLabel>Nov 30</BadgeLabel>
</Badge>
<Badge variant="success">
<BadgeIcon icon="circle-check" />
<BadgeLabel>Done</BadgeLabel>
</Badge>
<Badge variant="warning">
<BadgeIcon icon="triangle-alert" />
<BadgeLabel>Due soon</BadgeLabel>
</Badge>
<Badge variant="overdue">Dec 1</Badge>
<Badge variant="flag">Dec 4</Badge>
<Badge variant="tag">Note</Badge>
<Badge>
<BadgeLabel>Inbox</BadgeLabel>
<BadgeValue>12</BadgeValue>
</Badge>
</div>
);
}
function PlanMarks() {
return (
<div className="flex flex-wrap items-center gap-2">
<Badge solid>Trial</Badge>
<Badge solid variant="success">
Two months free
</Badge>
<Badge solid variant="outline">
Preview
</Badge>
</div>
);
}- Fits: list, overview (their recipes); list, record: row.
- In a Table, give a column of badges the track
auto: the column takes its widest badge whole. A fixed track narrower than a badge cuts its words. - height, width, padding, gap, corner, background, text: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| variant | default | outline | plain | flag | overdue | tag | success | warning | destructive | info = default | |
| solid? | boolean = false | The caps pill on a full fill in the variant's colour, words in capitals at the bold weight. |
| asChild? | boolean = false | Render the badge's look on the one child element instead of a span (a link, a button). |
| stateLabel? | string | The state the badge's colour or mark shows, said to a reader before its words and never painted ("Paid"). |
| Part | What it is |
|---|---|
| BadgeIcon | The badge's leading icon; icon: IconName — A pack icon name |
| BadgeLabel | The badge's words, after an optional BadgeIcon and before an optional BadgeValue |
| BadgeValue | The badge's count (<BadgeValue>{unread}</BadgeValue>, after its words or alone) |
- Class recipes (cva): badgeVariants (Badge), badgeSolidVariants
- data-slot values (to select a part by): badge, badge-icon, badge-indicator, badge-label, badge-value
Accessibility
- focus-visible: the browser's own (:focus-visible): write nothing
Notes for AI
Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.