---
title: "Badge"
description: "A short label next to content, such as a count, a status, or a plan name. Pick a color for the meaning, and use the link form to go to a page."
url: https://gelatinui.com/components/badge
markdown_url: https://gelatinui.com/components/badge.md
access: free
install: "npx shadcn@latest add @gelatin-ui/badge"
registry_item: https://gelatinui.com/r/badge.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Badge

> A short label next to content, such as a count, a status, or a plan name. Pick a color for the meaning, and use the link form to go to a page.

Page: https://gelatinui.com/components/badge

## When to use it

Best for: A short status, count, or plan name next to content.

- Use it for a short status, a count, or a plan name next to content.
- Put the word in the badge. For a status in green, amber, or blue, use `success`, `warning`, or `info`; for a red one, use `destructive`; for a neutral one, use `secondary`. Add a `Dot` when the status needs a color mark.
- In table rows, use `outline` or `ghost`. A `secondary` fill almost disappears on a hovered row in light mode.
- Use `size="lg"` next to a default 32px Button, and the default size next to an `sm` Button.
- To make it a link, pass `render={<a href="/changelog" />}` or a router link.

## When not to use it

- For an action, use a [Button](https://gelatinui.com/components/button.md).
- For a key or a shortcut, use a [Kbd](https://gelatinui.com/components/kbd.md).
- For a color mark with no box, use a [Dot](https://gelatinui.com/components/dot.md).

## Notes for agents

- Badge renders a `<span>`. For a link, pass `render` with an `<a>` or a router link; it then gets a hover and a focus ring.
- Use the status variants (`success`, `warning`, `info`, `destructive`) only for a status, with the status word inside.
- For a favicon, a logo, or a flag in the icon slot, add `badge-image` and put a `BadgeImage` first in the badge.

## Anatomy

```text
Badge
```

## API reference

### Badge

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `rounded` | `"default" \| "full"` | "full" |  |
| `size` | `"default" \| "lg"` | "default" |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "ghost" \| "info" \| "link" \| "media" \| "outline" \| "secondary" \| "success" \| "warning"` | "default" |  |

Also takes every prop of Base UI `UseRender`: https://base-ui.com/react/components/use-render

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Badge | `badge` |  |  | `status-colors` |

## Usage

Put a `BadgeImage` in the icon slot of the badge, then the text that names the thing, so the picture can stay decorative.

The sample also uses `badge-image`, which this add does not write. One command adds them with this item:

```bash
npx shadcn@latest add @gelatin-ui/badge @gelatin-ui/badge-image
```

```tsx title="source-pills.tsx"
import { Badge } from "@/components/ui/badge";
import { BadgeImage } from "@/components/ui/badge-image";

const SOURCES = ["react.dev", "developer.mozilla.org", "web.dev"];

export function SourcePills() {
  return (
    <div className="flex flex-wrap items-center gap-2">
      {SOURCES.map((source) => {
        return (
          <Badge key={source} variant="secondary" render={<a href={`https://${source}`} />}>
            <BadgeImage data-icon="inline-start" src={`https://${source}/favicon.ico`} />
            {source}
          </Badge>
        );
      })}
    </div>
  );
}
```

## Compose

Build it with:

- [Filters](https://gelatinui.com/components/filters.md): Narrows the records.
- [Data Table](https://gelatinui.com/components/data-table.md): Shows the records in rows, with sort and select.
- [Menu](https://gelatinui.com/components/menu.md): Holds the actions of one row.
- [Pagination](https://gelatinui.com/components/pagination.md): Moves between pages.
- [Empty](https://gelatinui.com/components/empty.md): Shows when no record matches, with a next action.
- [Skeleton](https://gelatinui.com/components/skeleton.md): Holds the layout while the rows load.
- [Workspace](https://gelatinui.com/components/workspace.md): Holds the app shell: the sidebar and the page.
- [Frame](https://gelatinui.com/components/frame.md): Groups a row of numbers or a summary.

Rules:

- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.
- Color has a job (`color-has-a-job`): Use color only for a status, the brand action, or data; keep the rest neutral, and show a level with a small mark (a dot, a tinted badge) before a big fill.
- Real content (`real-content`): Fill the UI with content of the real product (real names, amounts, dates, and states), never lorem text or "Item 1".
- Steady text weight (`steady-weight`): Never change the font weight on hover, focus, selected, active, or open; change the color or the fill, so the text does not jump.

Patterns: `gelatin://patterns/data-list`, `gelatin://patterns/dashboard-overview`, `gelatin://patterns/app-sidebar`

## Add it

```bash
npx shadcn@latest add @gelatin-ui/badge
```

It adds 5 registry items: 3 files, 493 lines, and the npm packages `@base-ui/react`, `tailwind-merge`, `tailwind-variants`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Dot](https://gelatinui.com/components/dot.md)
- [Button](https://gelatinui.com/components/button.md)
- [Kbd](https://gelatinui.com/components/kbd.md)
- [Tag Group](https://gelatinui.com/components/tag-group.md): Pick Tag Group for a set of tags that people focus, remove, or pick as filters.

## Accessibility

Badge renders a `<span>` with no role and no focus stop. A screen reader reads its text with the content around it.

Always give a badge text. An empty badge is a small circle with no name. A status `Dot` in a badge is hidden from screen readers, so the word carries the status and color is never the only sign.

With `render={<a href="…" />}`, the badge is a link. It gets a hover fill, a 3px focus ring on keyboard focus, and, on a coarse pointer, a touch target of at least 44 × 44px (`hit-area`).

For a badge that shows its details, such as a Tooltip with the reason of a status, render the Base UI Button through `render`, not a raw `<button>`. Give it an `aria-label` that says the full status.

`BadgeImage` is decorative by default (`alt=""`): the badge text names the thing.
