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

# mds-label

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

The `<mds-label>` web component is the Magma Design System tag/chip used to display a short, non-interactive piece of text such as a status, a category, or a removable selection.

#### Semantic Behavior

- **Text content**: The visible text comes from the `label` prop only; the component renders no `<slot>`, so content placed between the tags is not displayed.
- **Deletable affordance**: When `deletable` is set, the component renders a trailing close button and emits the `mdsLabelDelete` event on activation; the click is stopped at the close button, so it does not reach a surrounding clickable container.
- **Keyboard interaction**: While `deletable`, the close button can be triggered by keyboard as well as pointer.
- **Localization**: The close button's `title` is localized (el/en/it; `es` currently gets the English string).

#### Properties & Visual Configurations

The `variant` and `tone` props follow the shared ladders defined in [`agents/variants.md`](../../../../agents/variants.md); `tone` is limited to the minimal `'strong'` / `'weak'` set and defaults to `'weak'`.

#### Component-specific variants and tones

`variant` accepts both the theme label palette (e.g. `'sky'`, the default) and the status palette (`'error'`, `'warning'`, `'success'`, `'info'`). Pick a status value when the label communicates an outcome or state; pick a theme color when it is a neutral category or decorative tag.

#### Other behavioral props

- **`truncate`** controls overflow handling of the inner text: `'word'` (default) keeps it on one line, `'all'` wraps and clamps it to three lines with an ellipsis, and `'none'` allows multiline wrapping. In every mode the label is as wide as its text, up to the width it is given (its own `width` or its container's), and `'all'` and `'none'` wrap the text at that width.
- **`typography`** selects a compact type scale (`'caption'`, `'detail'`, `'tip'`) appropriate to the label's small footprint, defaulting to `'caption'`.

## 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-label--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 |
| --- | --- | --- | --- | --- |
| `deletable` | `deletable` | `boolean` | `false` | Enables the cross icon to perform cancel/delete action on element |
| `label` | `label` | `string \| undefined` | - | The label of the component |
| `tone` | `tone` | `"strong" \| "weak"` | `'weak'` | Sets the tone of the color variant |
| `truncate` | `truncate` | `"all" \| "none" \| "word" \| undefined` | `'word'` | Truncates text inside the label or displays it in multiline if needed |
| `typography` | `typography` | `"caption" \| "detail" \| "tip"` | `'caption'` | Specifies the typography of the element |
| `variant` | `variant` | `"amaranth" \| "aqua" \| "blue" \| "error" \| "green" \| "info" \| "lime" \| "orange" \| "orchid" \| "purple" \| "red" \| "sky" \| "success" \| "violet" \| "warning" \| "yellow"` | `'sky'` | Sets the theme variant colors |

## Events

| Event | Detail | Description |
| --- | --- | --- |
| `mdsLabelDelete` | `void` | Emits when the label has to be cancelled |

## CSS custom properties

| Property | Description |
| --- | --- |
| `--mds-label-background` | The background color of the label component. |
| `--mds-label-color` | The text color of the label. |

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

## Dependencies

Uses: `mds-text`, `mds-button`.
