# Badge

Source: https://ecosphere.dev/docs/data/badge (Ecosphere 1.5). Install `vue-ecosphere` for Vue 3 or `react-ecosphere` for React 18.2+/19: same components, props, markup and stylesheet.

Status badges with a dot — success, warning, danger, accent, neutral — plus a notification count, which is a quantity rather than a state.

`import { EcoBadge } from "vue-ecosphere"`

## Status

Status colour travels only through badge and score, and never alone: every badge carries its own text label, so the state survives for anyone who cannot separate the hues.

Vue (vue-ecosphere):

```vue
<EcoBadge tone="success">Resolved</EcoBadge>
<EcoBadge tone="warning">Awaiting review</EcoBadge>
<EcoBadge tone="danger">Failed</EcoBadge>
<EcoBadge tone="accent">Scheduled</EcoBadge>
<EcoBadge tone="neutral">Archived</EcoBadge>
```

React (react-ecosphere):

```tsx
<EcoBadge tone="success">Resolved</EcoBadge>
<EcoBadge tone="warning">Awaiting review</EcoBadge>
<EcoBadge tone="danger">Failed</EcoBadge>
<EcoBadge tone="accent">Scheduled</EcoBadge>
<EcoBadge tone="neutral">Archived</EcoBadge>
```

## Notification count

Filled rather than tinted, no dot, tabular figures. Under two digits it is a 19px circle; past that it grows into a pill. Danger by default; accent or neutral when the count is informational.

Vue (vue-ecosphere):

```vue
<EcoBadge :count="3" />
<EcoBadge :count="12" />
<EcoBadge :count="128" />
<EcoBadge :count="9" tone="accent" />
```

React (react-ecosphere):

```tsx
<EcoBadge count={3} />
<EcoBadge count={12} />
<EcoBadge count={128} />
<EcoBadge count={9} tone="accent" />
```

## API

Vue (vue-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `tone` | `"success" \| "warning" \| "danger" \| "accent" \| "neutral"` | "neutral" | Status colour. Every tone but neutral shows a dot. On a count, only accent and neutral apply. |
| `label` | `string` | — | Text when you don't use the default slot. A status badge always carries one. |
| `count` | `number \| string` | — | Render a notification count (badge--notification) instead of a status. |
| `max` | `number` | — | Cap the count: 99 shows “99+”. |

React (react-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `tone` | `"success" \| "warning" \| "danger" \| "accent" \| "neutral"` | "neutral" | Status colour. Every tone but neutral shows a dot. On a count, only accent and neutral apply. |
| `label` | `string` | — | Text when you don't pass children. A status badge always carries one. |
| `count` | `number \| string` | — | Render a notification count (badge--notification) instead of a status. |
| `max` | `number` | — | Cap the count: 99 shows “99+”. |
