# u-badge

```ts
import '@iyulab/components/dist/components/badge/UBadge.js';
```

**Tag:** `u-badge`

Status badge for numbers, labels, or dot indicators. Use `anchor` to position it absolutely on a parent element.

```html
<!-- Standalone -->
<u-badge color="red">5</u-badge>

<!-- Anchored on another element -->
<div style="position:relative; display:inline-block;">
  <u-icon lib="tabler" name="bell"></u-icon>
  <u-badge shape="dot" color="red" anchor="top-right"></u-badge>
</div>
```

---

## Slots

| Name | Description |
|------|-------------|
| `prefix` | Content before the main label |
| *(default)* | Badge label (text or icon) |
| `suffix` | Content after the main label |

## CSS Parts

| Part | Description |
|------|-------------|
| `base` | Outer badge box |
| `icon` | Status icon (rendered only with `icon` + a semantic `color`) |

## Properties

| Property | Type | Default | Reflect | Description |
|----------|------|---------|---------|-------------|
| `shape` | `'pill'\|'dot'\|'square'` | `'pill'` | ✓ | Shape; `dot` renders no content |
| `color` | `'neutral'\|'primary'\|'secondary'\|'info'\|'success'\|'warning'\|'danger'\|'blue'\|'green'\|'yellow'\|'red'\|'orange'\|'teal'\|'cyan'\|'purple'\|'pink'` | `'blue'` | ✓ | Badge color (role axis = semantics, decorative axis = the color itself) |
| `anchor` | `'top-right'\|'top-left'\|'bottom-right'\|'bottom-left'` | — | ✓ | Absolute anchor position relative to parent |
| `icon` | `boolean` | `false` | ✓ | Adds a status icon so the meaning survives without color (`info`/`success`/`warning`/`danger`; not drawn for `shape="dot"`) |
