# Badge

A small label that marks nearby content with a status or category. Renders a `span`, or the `render` element, and forwards its ref.

## Use for

- a status label such as Active or Failed
- a category or role tag next to a name
- a "New" marker

## Practices

- Do: Pick `color` by meaning: `positive` for success, `negative` for failure, `warning` for attention.
- Do: Pass `render` to make a badge a link, such as `render={<a href="/billing" />}`.
- Don't: Use a badge for a message the user must read. Use `Banner` instead.

## API reference

### Badge

The label. `color` defaults from `BadgeContext` when a parent sets it.

Slot: `cl-badge`

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `color` | `'primary' \| 'neutral' \| 'warning' \| 'negative' \| 'positive'` | `'primary'` | `primary`, `neutral`, `warning`, `negative` or `positive`. |

## Examples

### A status

```tsx
<Badge color='positive'>Active</Badge>
```

### As a link

```tsx
<Badge render={<a href='/billing' />}>Upgrade</Badge>
```

## Related

- [Banner](/docs/components/banner.md)
