{
  "timestamp": "2026-11-19T09:33:56",
  "compiler": {
    "name": "@stencil/core",
    "version": "4.45.4",
    "typescriptVersion": "5.8.3"
  },
  "storybook": "https://magma-design-system.github.io/magma/storybook/",
  "studio": "https://magma-design-system.github.io/magma/studio/",
  "components": [
    {
      "filePath": "src/components/mds-badge/mds-badge.tsx",
      "encapsulation": "shadow",
      "tag": "mds-badge",
      "docs": "This is a web-component from Maggioli Design System [Magma](https://magma.maggiolicloud.it), built with StencilJS, TypeScript, Storybook. It's based on the web-component standard and it's designed to be agnostic from the JavaScript framework you are using.",
      "docsTags": [
        {
          "name": "slot",
          "text": "- **Deprecated**, use the `label` property instead. Add `text string` to this slot, **avoid** to add `HTML elements` or `components` here."
        },
        {
          "name": "category",
          "text": "tags"
        }
      ],
      "usage": {
        "1. Description": "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.\n\n#### Semantic Behavior\n\n- **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.\n- **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.\n- **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.\n\n#### Properties & Visual Configurations\n\nThe 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\"`.\n\n- **`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.\n\n#### Other behavioral props\n\n- **`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).\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-badge>` component, ordered from most common to most specialized. The examples assume a working knowledge of the variant / tone ladders documented in [`agents/variants.md`](../../../../agents/variants.md) and the shared component rules in [`agents/conventions.md`](../../../../agents/conventions.md).\n\n#### Basic Badge via `label` Prop\n\nThe canonical form. Use the `label` prop for the badge's text content - it is the preferred source and the slot is deprecated.\n\n```html\n<mds-badge label=\"Attivo\" variant=\"success\" tone=\"weak\"></mds-badge>\n```\n\n#### Variant and Tone for Emphasis\n\nPair the same `variant` with a different `tone` to control visual weight. `tone=\"weak\"` (default) is the lightest fill; `tone=\"strong\"` is a saturated solid; `tone=\"outline\"` adds a visible border with a transparent background.\n\n```html\n<!-- Low emphasis: subtle tinted fill (default) -->\n<mds-badge label=\"Bozza\" variant=\"warning\" tone=\"weak\"></mds-badge>\n\n<!-- High emphasis: solid saturated fill -->\n<mds-badge label=\"Urgente\" variant=\"error\" tone=\"strong\"></mds-badge>\n\n<!-- Minimal emphasis: bordered, no fill -->\n<mds-badge label=\"Archiviato\" variant=\"dark\" tone=\"outline\"></mds-badge>\n```\n\n#### Status Variants\n\nUse status variants (`info`, `success`, `warning`, `error`) to communicate state. Match the variant to the meaning, not to the colour you want.\n\n```html\n<mds-badge label=\"Completato\" variant=\"success\" tone=\"weak\"></mds-badge>\n<mds-badge label=\"In attesa\" variant=\"info\" tone=\"weak\"></mds-badge>\n<mds-badge label=\"Attenzione\" variant=\"warning\" tone=\"weak\"></mds-badge>\n<mds-badge label=\"Errore\" variant=\"error\" tone=\"weak\"></mds-badge>\n```\n\n#### Decorative Label Variants\n\nUse decorative label variants (`green`, `blue`, `violet`, `red`, `orange`, `yellow`, `lime`, `aqua`, `sky`, `orchid`, `purple`, `amaranth`) for categorical tags, topics, or visual grouping that carries no semantic state meaning. The default variant is `green`.\n\n```html\n<mds-badge label=\"Ambiente\" variant=\"green\"></mds-badge>\n<mds-badge label=\"Tecnologia\" variant=\"blue\"></mds-badge>\n<mds-badge label=\"Design\" variant=\"violet\"></mds-badge>\n<mds-badge label=\"Marketing\" variant=\"orange\"></mds-badge>\n```\n\n#### Neutral Variants\n\n`variant=\"dark\"` and `variant=\"light\"` are painted with neutral roles that follow the mode, so neither is tied to a light or dark background. They differ only with `tone=\"strong\"`: `dark` is the inverse chip (dark on a light UI, light on a dark UI), `light` is the paper of the mode (white in light, black in dark). With `weak` and `outline` the two render the same.\n\n```html\n<!-- Inverse chip, flips with the mode -->\n<mds-badge label=\"Categoria\" variant=\"dark\" tone=\"strong\"></mds-badge>\n\n<!-- Paper of the mode -->\n<mds-badge label=\"Categoria\" variant=\"light\" tone=\"strong\"></mds-badge>\n```\n\n#### Typography Scale\n\nThe default `\"option\"` is the smaller scale and suits dense contexts such as table cells; use `typography=\"label\"`, which is larger, when the badge needs more presence.\n\n```html\n<!-- Default, smaller scale - inside tables or tight UI rows -->\n<mds-badge label=\"Nuovo\" variant=\"sky\" typography=\"option\"></mds-badge>\n\n<!-- Larger scale - standalone labels, cards, sidebars -->\n<mds-badge label=\"Nuovo\" variant=\"sky\" typography=\"label\"></mds-badge>\n```\n\n#### Badge Inside a Table Cell\n\n`<mds-badge>` is commonly used as a status indicator inside [`mds-table`](../mds-table/AGENTS.md) cells.\n\n```html\n<mds-table>\n  <mds-table-body>\n    <mds-table-row>\n      <mds-table-cell>\n        <mds-badge label=\"Approvato\" variant=\"success\" tone=\"weak\"></mds-badge>\n      </mds-table-cell>\n      <mds-table-cell>\n        <mds-badge label=\"In revisione\" variant=\"warning\" tone=\"weak\"></mds-badge>\n      </mds-table-cell>\n    </mds-table-row>\n  </mds-table-body>\n</mds-table>\n```\n\n#### Badge Inside a File Listing\n\n[`mds-file`](../mds-file/AGENTS.md) and [`mds-file-preview`](../mds-file-preview/AGENTS.md) render a badge internally to show the file type; you do not slot a badge into them. When adding a badge alongside file content elsewhere, compose it in the surrounding markup.\n\n```html\n<div class=\"file-meta\">\n  <mds-file filename=\"relazione-2024.pdf\"></mds-file>\n  <mds-badge label=\"Firmato\" variant=\"success\" tone=\"weak\"></mds-badge>\n</div>\n```\n\n#### Styling Customization\n\nStyle the badge only through its public `--mds-badge-*` CSS custom properties. Use Magma color tokens via `rgb(var(--<token>))` so dark mode and high-contrast modes keep working.\n\n```css\n.custom-tag mds-badge {\n  --mds-badge-background: rgb(var(--label-orchid-09));\n  --mds-badge-color: rgb(var(--label-orchid-02));\n}\n```\n\nFor `tone=\"outline\"`, the border is not a public custom property: its color follows the `variant` prop. The outline badge is always transparent, so `--mds-badge-background` has no effect on it:\n\n```html\n<mds-badge label=\"Archiviato\" variant=\"orchid\" tone=\"outline\"></mds-badge>\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-badge>`. Each entry pairs the wrong form with the right one and a one-line reason. System-wide rules (boolean-as-string, shadow piercing, Tailwind color utilities, raw native event listening) live in [`agents/mistakes.md`](../../../../agents/mistakes.md) - they apply here too but are not repeated.\n\n#### Do Not Put HTML in the Default Slot\n\nThe default slot is deprecated and accepts plain text only; nested elements are stripped or break layout. Use the `label` prop instead.\n\n```html\n<!-- INCORRECT -->\n<mds-badge>\n  <strong>Urgente</strong>\n</mds-badge>\n\n<!-- CORRECT -->\n<mds-badge label=\"Urgente\" variant=\"error\" tone=\"strong\"></mds-badge>\n```\n\n#### Do Not Use the Slot When `label` Is Available\n\nSlotted text still works as a legacy fallback but will be removed in a future release. The `label` prop is the documented API going forward.\n\n```html\n<!-- INCORRECT -->\n<mds-badge>Approvato</mds-badge>\n\n<!-- CORRECT -->\n<mds-badge label=\"Approvato\" variant=\"success\" tone=\"weak\"></mds-badge>\n```\n\n#### Do Not Apply a `tone` Value Outside the Allowed Set\n\n`<mds-badge>` uses `ToneSmartVariantType`, which allows only `strong`, `weak`, and `outline`. Values like `text` or `box` are not accepted: no tone style matches them, so the badge renders as with `strong`, not with the `weak` default.\n\n```html\n<!-- INCORRECT -->\n<mds-badge label=\"Bozza\" variant=\"warning\" tone=\"text\"></mds-badge>\n<mds-badge label=\"Bozza\" variant=\"warning\" tone=\"box\"></mds-badge>\n\n<!-- CORRECT -->\n<mds-badge label=\"Bozza\" variant=\"warning\" tone=\"outline\"></mds-badge>\n```\n\n#### Do Not Use Legacy `ghost` or `quiet` Tone Values\n\n`tone=\"ghost\"` and `tone=\"quiet\"` are Magma 1 names: on `<mds-badge>` Magma 2.0 renamed them to `outline` and `weak` (the codemod applies the rename). Neither old name is valid any more.\n\n```html\n<!-- INCORRECT (Magma 1.x naming) -->\n<mds-badge label=\"Archiviato\" tone=\"ghost\" variant=\"dark\"></mds-badge>\n\n<!-- CORRECT (Magma 2.x) -->\n<mds-badge label=\"Archiviato\" tone=\"outline\" variant=\"dark\"></mds-badge>\n```\n\n#### Do Not Pick a Variant for Its Color Alone\n\n`variant` carries semantic meaning - status variants (`error`, `warning`, `success`, `info`) communicate state; label variants (`green`, `blue`, `violet`, etc.) communicate category. Do not choose a variant just because its color looks right.\n\n```html\n<!-- INCORRECT: using \"error\" to get a red tag for a topic, not an error state -->\n<mds-badge label=\"Ruby\" variant=\"error\" tone=\"weak\"></mds-badge>\n\n<!-- CORRECT: use a decorative label variant for non-state tags -->\n<mds-badge label=\"Ruby\" variant=\"red\" tone=\"weak\"></mds-badge>\n```\n\n#### Do Not Customize via Undocumented Selectors\n\nThe supported customization surface is the public `--mds-badge-*` CSS custom properties. Targeting shadow-DOM internals via `>>>`, `/deep/`, or undocumented `::part()` names couples your code to implementation details that can change on any release.\n\n```css\n/* INCORRECT */\nmds-badge >>> span {\n  font-weight: bold;\n  letter-spacing: 0.1em;\n}\n\n/* CORRECT */\nmds-badge {\n  --mds-badge-background: rgb(var(--label-violet-09));\n  --mds-badge-color: rgb(var(--label-violet-02));\n}\n```\n\n#### Do Not Use `<mds-badge>` for Interactive Controls\n\n`<mds-badge>` is purely presentational - it emits no events and has no focus management. For a selectable or dismissible tag, use [`mds-chip`](../mds-chip/AGENTS.md) instead.\n\n```html\n<!-- INCORRECT: listening to a click on a non-interactive component -->\n<mds-badge label=\"Rimuovi\" variant=\"error\" onclick=\"removeTag()\"></mds-badge>\n\n<!-- CORRECT: use mds-chip for interactive tag behavior -->\n<mds-chip label=\"Rimuovi\" variant=\"error\" deletable></mds-chip>\n```\n"
      },
      "props": [
        {
          "name": "label",
          "type": "string | undefined",
          "complexType": {
            "original": "string",
            "resolved": "string | undefined",
            "references": {}
          },
          "mutable": true,
          "attr": "label",
          "reflectToAttr": true,
          "docs": "The label of the badge",
          "docsTags": [],
          "values": [
            {
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "tone",
          "type": "\"outline\" | \"strong\" | \"weak\" | undefined",
          "complexType": {
            "original": "ToneSmartVariantType",
            "resolved": "\"outline\" | \"strong\" | \"weak\" | undefined",
            "references": {
              "ToneSmartVariantType": {
                "location": "import",
                "path": "@type/tone",
                "id": "src/type/tone.ts::ToneSmartVariantType",
                "referenceLocation": "ToneSmartVariantType"
              }
            }
          },
          "mutable": false,
          "attr": "tone",
          "reflectToAttr": true,
          "docs": "Sets the tone of the color variant",
          "docsTags": [
            {
              "name": "default",
              "text": "'weak'"
            }
          ],
          "default": "'weak'",
          "values": [
            {
              "value": "outline",
              "type": "string"
            },
            {
              "value": "strong",
              "type": "string"
            },
            {
              "value": "weak",
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "typography",
          "type": "\"label\" | \"option\"",
          "complexType": {
            "original": "TypographyLabelType",
            "resolved": "\"label\" | \"option\"",
            "references": {
              "TypographyLabelType": {
                "location": "import",
                "path": "@type/typography",
                "id": "src/type/typography.ts::TypographyLabelType",
                "referenceLocation": "TypographyLabelType"
              }
            }
          },
          "mutable": false,
          "attr": "typography",
          "reflectToAttr": true,
          "docs": "Specifies the typography of the element",
          "docsTags": [
            {
              "name": "default",
              "text": "'option'"
            }
          ],
          "default": "'option'",
          "values": [
            {
              "value": "label",
              "type": "string"
            },
            {
              "value": "option",
              "type": "string"
            }
          ],
          "optional": false,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "variant",
          "type": "\"amaranth\" | \"aqua\" | \"blue\" | \"dark\" | \"error\" | \"green\" | \"info\" | \"light\" | \"lime\" | \"orange\" | \"orchid\" | \"purple\" | \"red\" | \"sky\" | \"success\" | \"violet\" | \"warning\" | \"yellow\" | undefined",
          "complexType": {
            "original": "ThemeFullVariantType",
            "resolved": "\"amaranth\" | \"aqua\" | \"blue\" | \"dark\" | \"error\" | \"green\" | \"info\" | \"light\" | \"lime\" | \"orange\" | \"orchid\" | \"purple\" | \"red\" | \"sky\" | \"success\" | \"violet\" | \"warning\" | \"yellow\" | undefined",
            "references": {
              "ThemeFullVariantType": {
                "location": "import",
                "path": "@type/variant",
                "id": "src/type/variant.ts::ThemeFullVariantType",
                "referenceLocation": "ThemeFullVariantType"
              }
            }
          },
          "mutable": false,
          "attr": "variant",
          "reflectToAttr": true,
          "docs": "Sets the theme variant colors",
          "docsTags": [
            {
              "name": "default",
              "text": "'green'"
            }
          ],
          "default": "'green'",
          "values": [
            {
              "value": "amaranth",
              "type": "string"
            },
            {
              "value": "aqua",
              "type": "string"
            },
            {
              "value": "blue",
              "type": "string"
            },
            {
              "value": "dark",
              "type": "string"
            },
            {
              "value": "error",
              "type": "string"
            },
            {
              "value": "green",
              "type": "string"
            },
            {
              "value": "info",
              "type": "string"
            },
            {
              "value": "light",
              "type": "string"
            },
            {
              "value": "lime",
              "type": "string"
            },
            {
              "value": "orange",
              "type": "string"
            },
            {
              "value": "orchid",
              "type": "string"
            },
            {
              "value": "purple",
              "type": "string"
            },
            {
              "value": "red",
              "type": "string"
            },
            {
              "value": "sky",
              "type": "string"
            },
            {
              "value": "success",
              "type": "string"
            },
            {
              "value": "violet",
              "type": "string"
            },
            {
              "value": "warning",
              "type": "string"
            },
            {
              "value": "yellow",
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        }
      ],
      "methods": [],
      "events": [],
      "listeners": [],
      "styles": [
        {
          "name": "--mds-badge-background",
          "annotation": "prop",
          "docs": "Sets the background-color of the component",
          "visibility": "public"
        },
        {
          "name": "--mds-badge-border-color",
          "annotation": "prop",
          "docs": "Sets the border color of the component when tone is \"outline\"",
          "visibility": "internal"
        },
        {
          "name": "--mds-badge-border-width",
          "annotation": "prop",
          "docs": "Sets the border width of the component when tone is \"outline\"",
          "visibility": "internal"
        },
        {
          "name": "--mds-badge-color",
          "annotation": "prop",
          "docs": "Sets the text color of the component",
          "visibility": "public"
        },
        {
          "name": "--mds-badge-radius",
          "annotation": "prop",
          "docs": "Sets the border-radius of the component",
          "visibility": "public"
        }
      ],
      "slots": [
        {
          "name": "",
          "docs": "**Deprecated**, use the `label` property instead. Add `text string` to this slot, **avoid** to add `HTML elements` or `components` here."
        }
      ],
      "parts": [],
      "states": [],
      "dependents": [
        "mds-file",
        "mds-file-preview",
        "mds-stepper-bar-item",
        "mds-table"
      ],
      "dependencies": [
        "mds-text"
      ],
      "dependencyGraph": {
        "mds-badge": [
          "mds-text"
        ],
        "mds-file": [
          "mds-badge"
        ],
        "mds-file-preview": [
          "mds-badge"
        ],
        "mds-stepper-bar-item": [
          "mds-badge"
        ],
        "mds-table": [
          "mds-badge"
        ]
      },
      "storybook": "ui-badge--docs"
    }
  ]
}
