> ## Documentation Index
> Fetch the complete documentation index at: https://www.beeq.design/llms.txt
> Use this file to discover all available pages before exploring further.

# Badge

> Badges provide a compact visual indicator for status, presence, or counts tied to another UI element.

![BEEQ Badge component overview](https://mintcdn.com/beeq/wg4EwK5G4l2plt8W/components/images/badge/badge-overview-light.svg?fit=max\&auto=format\&n=wg4EwK5G4l2plt8W\&q=85\&s=7cac0046c225f4341cc586848a4e9cdc)

Badge component overview

Badges provide a compact visual cue for status, presence, or counts without taking up much space. They work best when attached to another element such as an icon, avatar, or navigation item so the meaning is immediately clear.

> [!NOTE]
>
> Use [Tag](https://www.beeq.design/components/tag.md) when the element needs to be interactive, dismissible, or read as a standalone labeled item. Badges are non-interactive indicators.

## When to use

> [card]
>
> Use badges when
>
> * You need to show a small count, status, or presence indicator
> * The badge is tied to another UI element such as an icon, avatar, or label
> * The information should be noticeable without dominating the layout

> [card]
>
> Do not use badges when
>
> * The content needs to be clicked, dismissed, or filtered
> * The message is essential enough that it should appear as regular text
> * Adding the badge would create clutter or repeat information the UI already communicates clearly

> [!TIP]
>
> Choose [`bq-tag`](https://www.beeq.design/components/tag) instead of `bq-badge` when the element needs a text label or must be clickable or removable, and [`bq-status`](https://www.beeq.design/components/status) when you need a dot with a text label that names a state. Use `bq-badge` for a count or dot attached to another element.

## Badge patterns

> [card] Dot indicator
>
> Use an empty badge to communicate presence, availability, or a lightweight status when a number is not needed.

> [card] Counter
>
> Use badge content to show the number of notifications, tasks, or updates associated with another element.

> [card] Semantic status
>
> Use semantic badge colors consistently to communicate informational, positive, warning, or error states.

## Anatomy

![BEEQ Badge component anatomy](https://mintcdn.com/beeq/wg4EwK5G4l2plt8W/components/images/badge/badge-anatomy-light.svg?fit=max\&auto=format\&n=wg4EwK5G4l2plt8W\&q=85\&s=3909eab354416fa0df9b1303694bbb6e)

Badge component anatomy

A badge is a compact surface with optional slotted content. When no content is provided, it renders as a dot indicator. When content is present, it expands to hold the number or short label.

| Part | Element | Description |
| - | - | - |
| **1** | Base | The container surface |
| **2** | Content | Optional number or short text |

## Design guidelines

### Size

Badge dot size is controlled by the `size` prop. Choose the size based on how much visual weight the indicator should carry in context.

**Allowed `size` values:** `small` (default), `medium`. The `size` prop only applies when the badge has no slot content.

> [!NOTE]
>
> The `size` prop only applies when the badge has **no content**. When you add slot content — a number or short label — the badge ignores `size` and auto-expands to fit the text.

| Size | Diameter | When to use |
| - | - | - |
| `small` | 8px | Default. Use in dense or compact layouts where a subtle dot signal is enough. |
| `medium` | 12px | Use when the badge needs slightly more presence, such as next to larger icons or in less crowded layouts. |

### Content length

Keep counter content short — three characters maximum, including the `+` symbol.

> [!TIP]
>
> When a count exceeds what fits, show `99+` or a similar capped value. The `+` signals overflow without needing an exact number.

## Usage

### Dot indicator

Use the badge without slot content when you only need a small visual signal. `size` matters most in this variant because it controls the dot diameter.

```html HTML icon="html5" theme={"theme":{"light":"one-light","dark":"night-owl"}}
<bq-badge></bq-badge>
<bq-badge size="medium"></bq-badge>
```

```jsx React icon="react" theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { BqBadge } from "@beeq/react";

<BqBadge />
<BqBadge size="medium" />
```

```ts Angular icon="angular" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { Component } from "@angular/core";
import { BqBadge } from "@beeq/angular/standalone";

@Component({
  selector: "app-root",
  standalone: true,
  imports: [BqBadge],
  template: `
    <bq-badge></bq-badge>
    <bq-badge size="medium"></bq-badge>
  `,
})
export class AppComponent {}
```

```vue Vue icon="vuejs" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
<script setup lang="ts">
import { BqBadge } from "@beeq/vue";
</script>

<template>
  <BqBadge />
  <BqBadge size="medium" />
</template>
```

> [!TIP]
>
> `small` is the default size, so you only need to set `size="medium"` when you want a larger indicator.

### Counter

Add slot content when the badge needs to communicate a count. Keep the value short and meaningful so the badge stays compact and easy to scan.

```html HTML icon="html5" theme={"theme":{"light":"one-light","dark":"night-owl"}}
<bq-badge>2</bq-badge>
<bq-badge>12</bq-badge>
```

```jsx React icon="react" theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { BqBadge } from "@beeq/react";

<BqBadge>2</BqBadge>
<BqBadge>12</BqBadge>
```

```ts Angular icon="angular" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { Component } from "@angular/core";
import { BqBadge } from "@beeq/angular/standalone";

@Component({
  selector: "app-root",
  standalone: true,
  imports: [BqBadge],
  template: `
    <bq-badge>2</bq-badge>
    <bq-badge>12</bq-badge>
  `,
})
export class AppComponent {}
```

```vue Vue icon="vuejs" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
<script setup lang="ts">
import { BqBadge } from "@beeq/vue";
</script>

<template>
  <BqBadge>2</BqBadge>
  <BqBadge>12</BqBadge>
</template>
```

## Options

### Color

Badge color should reinforce meaning, not create it on its own. Semantic usage should stay consistent so people learn what each color communicates across the product.

**Allowed `background-color` and `text-color` values:** any palette color token as a `string` (for example `ui--info`, `ui--success`, `ui--warning`, `ui--danger`, `text--inverse`). Both default to `undefined`, which renders the default badge color. You should set a matching `text-color` whenever you change `background-color`.

| Color | Typical meaning |
| - | - |
| `default` | Neutral presence or a generic indicator when no semantic state is needed |
| `ui--info` | Informational updates or newly available information |
| `ui--success` | Positive status, availability, or successful completion |
| `ui--warning` | Caution, review needed, or temporary attention |
| `ui--danger` | Errors, urgent issues, or disruptive states |

> [!TIP]
>
> Check the [Status](https://www.beeq.design/components/status.md) component for more details on semantic color usage and meaning in BEEQ.

### Attached to an icon

When a badge is paired with an icon or trigger, position it on the outer edge so it remains visible without covering the main symbol.

```css styles.css icon="css" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
.badge--icon {
  position: relative;
  display: inline-flex;

  & bq-badge {
    position: absolute;
    inset-block-start: -4px;
    inset-inline-end: -4px;
  }
}
```

```html HTML icon="html5" theme={"theme":{"light":"one-light","dark":"night-owl"}}
<div class="badge--icon" aria-label="Notifications">
  <bq-icon name="bell-ringing" size="24"></bq-icon>
  <bq-badge>9</bq-badge>
</div>
```

```jsx React icon="react" theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { BqBadge, BqIcon } from "@beeq/react";
import "./styles.css";

<div className="badge--icon" aria-label="Notifications">
  <BqIcon name="bell-ringing" size="24" />
  <BqBadge>9</BqBadge>
</div>
```

```ts Angular icon="angular" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
import { Component } from "@angular/core";
import { BqIcon, BqBadge } from "@beeq/angular/standalone";

@Component({
  selector: "app-root",
  standalone: true,
  imports: [BqIcon, BqBadge],
  template: `
    <div class="badge--icon" aria-label="Notifications">
      <bq-icon name="bell-ringing" size="24"></bq-icon>
      <bq-badge>9</bq-badge>
    </div>
  `,
  styles: [`
    .badge--icon {
      position: relative;
      display: inline-flex;

      & bq-badge {
        position: absolute;
        inset-block-start: -4px;
        inset-inline-end: -4px;
      }
    }
  `],
})
export class AppComponent {}
```

```vue Vue icon="vuejs" expandable theme={"theme":{"light":"one-light","dark":"night-owl"}}
<script setup lang="ts">
import { BqBadge, BqIcon } from "@beeq/vue";
</script>

<template>
  <div class="badge--icon" aria-label="Notifications">
    <BqIcon name="bell-ringing" size="24" />
    <BqBadge>9</BqBadge>
  </div>
</template>

<style>
  .badge--icon {
    position: relative;
    display: inline-flex;

    & bq-badge {
      position: absolute;
      inset-block-start: -4px;
      inset-inline-end: -4px;
    }
  }
</style>
```

> [!NOTE]
>
> To create a "cutout ring" effect — useful when a badge sits on top of an image or avatar — add a border using the `--bq-badge--border-color`, `--bq-badge--border-style`, and `--bq-badge--border-width` CSS custom properties. Match the border color to the surface behind the badge for a clean visual separation.

## Best practices

> [card]
>
> Do
>
> Use the supported badge sizes so indicators stay visually consistent across the product.

> [card]
>
> Don't
>
> Do not resize badges arbitrarily. Oversized indicators quickly feel noisy and unbalanced.

> [card]
>
> Do
>
> Show a badge only when there is relevant status or count information to communicate.

> [card]
>
> Don't
>
> Do not leave empty or unnecessary badges in the interface when there is nothing meaningful to show.

> [card]
>
> Do
>
> Place attached badges on the outer edge of the related icon or trigger so both elements remain visible.

> [card]
>
> Don't
>
> Do not center a badge over the element it refers to. It can obscure the symbol and reduce clarity.

> [card]
>
> Do
>
> Pair badges with another UI element so the status or count has clear context.

> [card]
>
> Don't
>
> Do not rely on a standalone badge in product UI unless its meaning is obvious from nearby content or a legend.

## Accessibility

Badges are visual indicators, not interactive controls. When a badge communicates count or status, the surrounding element or nearby text must also expose that meaning to assistive technologies.

Badges must not rely on color alone. When the badge carries important information such as unread notifications or an error state, you must provide text, a label, or an accessible name on the related control.

### Keyboard interaction

No keyboard interaction: the component is not focusable.

### Rules

| Rule | Strength | Verified by |
| - | - | - |
| Expose the badge meaning (count or status) through the surrounding element or nearby text | MUST | manual: read the count or status without its color |
| Provide text, a label, or an accessible name on the related control when the badge carries important information | MUST | manual: inspect the related control accessible name and nearby text |
| Do not rely on color alone | MUST NOT | manual: check that text or shape also conveys the badge meaning |

## API reference

### Properties

| Property | Attribute | Description | Type | Default |
| - | - | - | - | - |
| `backgroundColor` | `background-color` | Badge background color token | `string` | `undefined` |
| `size` | `size` | Dot size when no content is provided | `'small'` \| `'medium'` | `'small'` |
| `textColor` | `text-color` | Text color token used when content is present | `string` | `undefined` |

### Invalid combinations

| Combination | Strength | Result |
| - | - | - |
| `size` with slotted content | SHOULD NOT | `size` is ignored and the badge sizes itself to the content |

### Slots

| Slot | Description |
| - | - |
| default | Optional number or short text shown inside the badge |

### Shadow parts

| Part | Description |
| - | - |
| `base` | The visible badge wrapper |
| `number` | The element wrapping the default slot content |

### CSS custom properties

**CSS variables**

| Variable | Description | Default |
| - | - | - |
| `--bq-badge--background-color` | Badge background color | `var(--bq-ui--danger)` |
| `--bq-badge--box-shadow` | Badge box shadow | `none` |
| `--bq-badge--border-color` | Badge border color | `var(--bq-stroke--tertiary)` |
| `--bq-badge--border-radius` | Badge border radius | `var(--bq-radius--full)` |
| `--bq-badge--border-style` | Badge border style | `none` |
| `--bq-badge--border-width` | Badge border width | `0` |
| `--bq-badge--size-small` | Small badge size | `8px` |
| `--bq-badge--size-medium` | Medium badge size | `12px` |
| `--bq-badge--size-large` | Minimum size used by content badges | `16px` |
| `--bq-badge--text-color` | Badge text color | `var(--bq-text--on-danger)` |

> [!TIP]
>
> Learn more about [styling with shadow parts](https://www.beeq.design/guides/styles.md#component-shadow-dom-parts) and [CSS custom properties](https://www.beeq.design/guides/styles.md#global-css-custom-properties).

## Resources

> [card] [Interactive playground](https://storybook.beeq.design/?path=/story/components-badge--default)
>
> Explore badge states and examples in Storybook

> [card] [Source code](https://github.com/Endava/BEEQ/tree/main/packages/beeq/src/components/badge)
>
> View the component source on GitHub


## Related topics

- [Avatar](https://www.beeq.design/components/avatar.md)
- [Component CSS Variables](https://www.beeq.design/theming/component-css-variables.md)
- [Changelog](https://www.beeq.design/releases/changelog.md)
- [Global CSS Variables](https://www.beeq.design/theming/global-css-variables.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.