---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Badge

A small pill with a word, an icon or a count, for a status, a tag or a label beside a title or in a row, for React and Tailwind CSS. Free, MIT.

Free. Its export: `Badge`.

## Try it

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 pill with a word, an icon or a count, for a status, a tag or a label 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.

```sh
npx shadcn@4.23.1 add @goop/trail-badge
```

```text
Add the Goop Badge to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { Badge, BadgeIcon, BadgeLabel, BadgeValue } from '@/components/ui/goop/badge';

<>
  <Badge variant="success">
    <BadgeIcon icon="circle-check" />
    <BadgeLabel>Paid</BadgeLabel>
  </Badge>
  <Badge variant="warning">
    <BadgeLabel>Due</BadgeLabel>
  </Badge>
  <Badge variant="outline">
    <BadgeIcon icon="history" />
    <BadgeLabel>To sync</BadgeLabel>
    <BadgeValue>{3}</BadgeValue>
  </Badge>
</>
```

- Fits: list, record: row.
- In a Table, give a column of badges the track `auto`, never a guessed px width (a narrower track cuts a pill's words). In a grid of your own, an `auto` track is exactly the pill's width: give its cells `pe-6`.
- height, width, padding, corner, background, shadow, text, motion: add no class for these.

## API reference

### Options

- `variant: default | outline | success | warning | destructive | info = default`
- `asChild?: boolean = false` — Render the badge's look on the one child element instead of a `span` (a link, a button).

### Parts

- `BadgeIcon` — The badge's leading icon; icon: IconName — A pack icon name
- `BadgeLabel` — The status words in a Badge, 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)
- data-slot values (to select a part by): badge, badge-icon, badge-label, badge-value, badge-value-item

## Accessibility

- hover, active, focus-visible: the browser's own (:hover, :active, :focus-visible): write nothing
- disabled: the prop disabled

## Motion

- The part sets its own motion: add no transition or animation of your own.

## 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.

## Related

- [Avatar](/themes/trail/components/avatar): A person's or a team's picture or initials, beside their name or on its own.
- [Avatar group](/themes/trail/components/avatar-group): A row of people's avatars overlapping one another, for who is on a project or in a thread.
- [Identity](/themes/trail/components/identity): A person as an avatar beside their name and an email or a role.
- [Card](/themes/trail/components/card): A framed surface that holds one piece of content or a list of settings rows.
