<!--
  GENERATED FILE - do not edit by hand.
  Source of truth: src/components/mds-badge/ in the magma monorepo (usage/*.md and the
  component's JSDoc). Regenerated on every stencil build (scripts/component-docs.ts).
-->

# mds-badge

> `@maggioli-design-system/magma` 2.15.0. Shadow DOM: style it only through the public CSS custom properties and the parts below.

The `<mds-badge>` web component is the Magma Design System's compact status and label indicator, used to attach a short categorical signal (count, state, tag) to other content. It is purely presentational and has no HTML primitive equivalent.

#### Semantic Behavior

- **Text-only content**: The badge is meant to carry a short text string, not markup; the `label` prop is the supported source of that text.
- **Deprecated default slot**: Slotted text is still read as a legacy fallback, but only when `label` is empty - once `label` is set it always wins. HTML elements or components in the slot are unsupported.
- **No interactivity**: The component emits no events, has no form association, no focus management, and no disabled/active state - it is a static visual marker.

#### Properties & Visual Configurations

The shared `variant` / `tone` ladders are defined in [`agents/variants.md`](../../../../agents/variants.md); `<mds-badge>` consumes them directly and does not add any component-specific values. The default appearance is `variant="green"` with `tone="weak"`.

- **`tone`** selects the chrome treatment: `'weak'` for a subtle tinted fill (the default, best for dense lists and tables), `'strong'` for a saturated high-emphasis fill, and `'outline'` for a bordered, transparent-fill badge that reads as the lightest emphasis.

#### Other behavioral props

- **`typography`** chooses the internal text scale - `'option'` (default, the smaller one) or `'label'` - to align the badge's text size with the surrounding context (e.g. inside a denser table cell vs. a standalone label).

## Read next

- [`examples.md`](examples.md) - correct usage, from the most common case
- [`mistakes.md`](mistakes.md) - the wrong forms, each with the right one
- [Storybook](https://magma-design-system.github.io/magma/storybook/?path=/docs/ui-badge--docs) - the live examples, in the published Storybook of `main`
- [`conventions.md`](../../../../agents/conventions.md), [`variants.md`](../../../../agents/variants.md), [`mistakes.md`](../../../../agents/mistakes.md) - the rules shared by every component

## Props

| Prop | Attribute | Type | Default | Description |
| --- | --- | --- | --- | --- |
| `label` | `label` | `string \| undefined` | - | The label of the badge |
| `tone` | `tone` | `"outline" \| "strong" \| "weak" \| undefined` | `'weak'` | Sets the tone of the color variant |
| `typography` | `typography` | `"label" \| "option"` | `'option'` | Specifies the typography of the element |
| `variant` | `variant` | `"amaranth" \| "aqua" \| "blue" \| "dark" \| "error" \| "green" \| "info" \| "light" \| "lime" \| "orange" \| "orchid" \| "purple" \| "red" \| "sky" \| "success" \| "violet" \| "warning" \| "yellow" \| undefined` | `'green'` | Sets the theme variant colors |

## Slots

| Slot | Description |
| --- | --- |
| (default) | **Deprecated**, use the `label` property instead. Add `text string` to this slot, **avoid** to add `HTML elements` or `components` here. |

## CSS custom properties

| Property | Description |
| --- | --- |
| `--mds-badge-background` | Sets the background-color of the component |
| `--mds-badge-color` | Sets the text color of the component |
| `--mds-badge-radius` | Sets the border-radius of the component |

Only these are public. Its other 2 are internal: they may change in any release, do not set them.

## Dependencies

Uses: `mds-text`.
Used by: `mds-file`, `mds-file-preview`, `mds-stepper-bar-item`, `mds-table`.
