# @salmonui/notifications/badge API reference

> 10 exported symbols of @salmonui/notifications/badge: 1 function, 1 interface and 8 types.

Canonical: https://salmonui.dev/docs/reference/notifications/badge

```ts
import { … } from '@salmonui/notifications/badge';
```

## Functions

### Badge

Kind: function

Page: https://salmonui.dev/docs/reference/notifications/badge/Badge

```ts
function Badge(props: BadgeProps): ReactElement;
```

Badge. Inline (`<Badge tone="success">Paid</Badge>`) it is a text label,
or a status with `variant="dot"`; with `content` or `dot` it overlays its `children` at a logical corner.
Styling hooks: `.salmon-badge` with `data-tone`, `data-variant`,
`data-shape`, `data-dot`, `data-invisible`; overlay hosts are
`.salmon-badge-host` with `data-placement` and `data-overlap`. To fit the
0.5 KB budget a `data-*` hook is written only when its prop is set; the
stylesheet applies the defaults when it is absent.

## Interfaces

### BadgeInlineProps

Kind: interface

Page: https://salmonui.dev/docs/reference/notifications/badge/BadgeInlineProps

```ts
interface BadgeInlineProps extends BadgeCommonProps {
    variant?: BadgeVariant | undefined;
    children?: ReactNode;
    render?: ((props: BadgeRenderProps) => ReactElement) | undefined;
    content?: never;
    dot?: false | undefined;
    max?: never;
    placement?: never;
    overlap?: never;
    invisible?: never;
    label?: never;
    locale?: never;
}
```

Inline mode: `children` is the badge text.

Members (14):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `variant` | `variant?: BadgeVariant \| undefined;` | optional | Visual weight. Default `'soft'`; `'dot'` is a status dot before the text (the dot is decorative, the text carries the meaning). |
| `children` | `children?: ReactNode;` | optional | The badge text. |
| `render` | `render?: ((props: BadgeRenderProps) => ReactElement) \| undefined;` | optional | Renders another element (a link, a router link) with the computed props. |
| `content` | `content?: never;` | optional |  |
| `dot` | `dot?: false \| undefined;` | optional |  |
| `max` | `max?: never;` | optional |  |
| `placement` | `placement?: never;` | optional |  |
| `overlap` | `overlap?: never;` | optional |  |
| `invisible` | `invisible?: never;` | optional |  |
| `label` | `label?: never;` | optional |  |
| `locale` | `locale?: never;` | optional |  |
| `tone` | `tone?: BadgeTone;` | optional, inherited | Color role. Default `'neutral'`. |
| `shape` | `shape?: BadgeShape;` | optional, inherited | Corner shape. Default `'rounded'` inline, `'pill'` for overlay badges. |
| `ref` | `ref?: Ref<HTMLSpanElement>;` | optional, inherited | The root element: the badge inline, the host wrapper in overlay mode. |

## Types

### BadgeOverlap

Kind: type

Page: https://salmonui.dev/docs/reference/notifications/badge/BadgeOverlap

```ts
type BadgeOverlap = 'rectangular' | 'circular';
```

`'circular'` pulls the overlay inward for round hosts such as avatars.

### BadgeOverlayProps

Kind: type

Page: https://salmonui.dev/docs/reference/notifications/badge/BadgeOverlayProps

```ts
type BadgeOverlayProps = BadgeOverlayBase & ({
    content: ReactNode;
    dot?: false | undefined;
    label?: string | undefined;
} | {
    content?: undefined;
    dot: true;
    label: string;
});
```

Overlay mode, selected by the presence of the `content` or `dot` prop. `content` of `null`, `undefined`, `false` or `''` hides
the badge like `invisible` (`0` shows).

### BadgePlacement

Kind: type

Page: https://salmonui.dev/docs/reference/notifications/badge/BadgePlacement

```ts
type BadgePlacement = 'topEnd' | 'topStart' | 'bottomEnd' | 'bottomStart';
```

Corner of the host an overlay badge sits on; logical, mirrored under `dir="rtl"`.

### BadgeProps

Kind: type

Page: https://salmonui.dev/docs/reference/notifications/badge/BadgeProps

```ts
type BadgeProps = BadgeInlineProps | BadgeOverlayProps;
```

### BadgeRenderProps

Kind: type

Page: https://salmonui.dev/docs/reference/notifications/badge/BadgeRenderProps

```ts
type BadgeRenderProps = HTMLAttributes<HTMLElement> & {
    ref?: Ref<never> | undefined;
    [dataAttribute: `data-${string}`]: string | number | undefined;
};
```

Props `render` receives: class name,
`data-*` hooks, `style`, every other DOM prop, `ref` and `children`.
Spread all of them onto the returned element.

Members (1):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `ref` | `ref?: Ref<never>;` | optional, inherited |  |

### BadgeShape

Kind: type

Page: https://salmonui.dev/docs/reference/notifications/badge/BadgeShape

```ts
type BadgeShape = 'rounded' | 'pill' | 'circle';
```

Corner shape.

### BadgeTone

Kind: type

Page: https://salmonui.dev/docs/reference/notifications/badge/BadgeTone

```ts
type BadgeTone = 'neutral' | 'primary' | 'info' | 'success' | 'warning' | 'danger';
```

Color role: the neutral scale plus the five theme seeds.

### BadgeVariant

Kind: type

Page: https://salmonui.dev/docs/reference/notifications/badge/BadgeVariant

```ts
type BadgeVariant = 'soft' | 'solid' | 'outline' | 'dot';
```

Visual weight. `'dot'` (inline mode only) is a status label: a small
decorative dot in the tone color before plain text, as in a table cell.
