{
  "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-entity/mds-entity.tsx",
      "encapsulation": "shadow",
      "tag": "mds-entity",
      "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": "- Add `text string`, `HTML elements` or `components` to this slot."
        },
        {
          "name": "slot",
          "text": "action - Add `HTML elements` or `components`, it is **recommended** to use `mds-button` element."
        },
        {
          "name": "slot",
          "text": "detail - Add `HTML elements` or `components` to this slot."
        },
        {
          "name": "part",
          "text": "spinner - The spinner element"
        },
        {
          "name": "part",
          "text": "avatar - The avatar element"
        },
        {
          "name": "part",
          "text": "infos - The column that stacks the name (default slot) and the `detail` row"
        },
        {
          "name": "category",
          "text": "data"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-entity>` web component represents a person, organization, or resource as a compact identity block in the Magma Design System, pairing an avatar with a name, optional secondary details, and contextual actions. It has no native HTML equivalent; it standardises how entities are surfaced in lists, headers, and cards.\n\n#### Semantic Behavior\n\n- **Avatar resolution**: The leading avatar renders only when one of `src`, `icon`, or `initials` is provided. The inner `mds-avatar` resolves a combination pairwise: `icon` hides the `src` image, `initials` hide the `icon`, `src` hides the `initials`, and with all three set it shows none of them.\n- **Await state**: While `await` is set the avatar is suppressed and a spinner is shown in its place, signalling that the entity is still loading.\n- **Conditional regions**: The `detail` and `action` regions are shown only while content is projected into those slots, also when it is added after the first render.\n- **Default slot is the name**: The default slot carries the entity's primary label (text, HTML, or components) and is always rendered inside the info column (the `infos` part), above the `detail` row.\n\n#### Properties & Visual Configurations\n\n- **`src`** is the path to an entity image; **`icon`** is a Magma icon library slug; **`initials`** is the text shown when no image or icon fits. Provide only the one that best identifies the entity - they are not combined.\n- **`await`** marks the entity as loading and takes visual precedence over any avatar source.\n\nThe shared `tone` / `variant` ladders are defined in [`agents/variants.md`](../../../../agents/variants.md) and color the inner avatar. `tone` is limited to the minimal `'strong'` / `'weak'` pair, and `variant` accepts the avatar colour set; pick them to colour the avatar chip in line with the entity's category. With `initials` the avatar derives its colour from the letters and ignores `variant`.\n\n#### Slots\n\n- **`detail`** holds secondary information (role, email, status) rendered beneath the name.\n- **`action`** holds trailing controls; `mds-button` is the recommended element here.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-entity>` 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#### Person Entity with Image\n\nThe most common form. Supply `src` for the avatar image and put the entity name in the default slot. Use `<mds-text>` with `typography=\"h6\"` for the primary label so typography tokens are applied consistently.\n\n```html\n<mds-entity src=\"/avatars/mario-rossi.png\">\n  <mds-text truncate=\"word\" typography=\"h6\">Mario Rossi</mds-text>\n</mds-entity>\n```\n\n#### Entity with Initials Fallback\n\nWhen no image is available, provide `initials` instead of `src`. The avatar chip renders the initials text.\n\n```html\n<mds-entity initials=\"mr\">\n  <mds-text truncate=\"word\" typography=\"h6\">Mario Rossi</mds-text>\n</mds-entity>\n```\n\n#### Entity with Icon\n\nUse `icon` for non-person entities (locations, files, organizations). Reference icons by their slug from the Magma icon library.\n\n```html\n<mds-entity icon=\"mi/baseline/location-on\">\n  <mds-text truncate=\"word\" typography=\"h6\">Maggioli Headquarters</mds-text>\n</mds-entity>\n```\n\n#### Secondary Details via `detail` Slot\n\nProject additional information (role, email, status) into the `detail` slot. It renders below the primary name in a subdued color. Use `<mds-text typography=\"caption\">` for plain text details.\n\n```html\n<mds-entity src=\"/avatars/giulia-bianchi.png\">\n  <mds-text truncate=\"word\" typography=\"h6\">Giulia Bianchi</mds-text>\n  <mds-text truncate=\"word\" slot=\"detail\" typography=\"caption\">giulia@example.com</mds-text>\n  <mds-badge slot=\"detail\" variant=\"success\" tone=\"weak\" label=\"Attiva\"></mds-badge>\n</mds-entity>\n```\n\n#### Trailing Action Buttons via `action` Slot\n\nUse the `action` slot for icon-only `<mds-button>` elements. Each button is sized and spaced automatically by the component. Always provide `title` on icon-only buttons for accessibility.\n\n```html\n<mds-entity src=\"/avatars/luca-verdi.png\">\n  <mds-text truncate=\"word\" typography=\"h6\">Luca Verdi</mds-text>\n  <mds-text truncate=\"word\" slot=\"detail\" typography=\"caption\">luca@example.com</mds-text>\n  <mds-button slot=\"action\" icon=\"mdi/pencil\" variant=\"primary\" tone=\"strong\" title=\"Modifica\"></mds-button>\n  <mds-button slot=\"action\" icon=\"mdi/delete\" variant=\"error\" tone=\"strong\" title=\"Elimina\"></mds-button>\n</mds-entity>\n```\n\n#### Colored Avatar with `variant` and `tone`\n\nPair `variant` and `tone` to color the avatar chip by entity category. `tone` is limited to `strong` and `weak`; `variant` accepts the full avatar color set.\n\n```html\n<!-- Strong fill, primary variant -->\n<mds-entity icon=\"mi/baseline/business\" variant=\"primary\" tone=\"strong\">\n  <mds-text truncate=\"word\" typography=\"h6\">Divisione Commerciale</mds-text>\n</mds-entity>\n\n<!-- Weak tint, warning variant -->\n<mds-entity icon=\"mi/baseline/warning\" variant=\"warning\" tone=\"weak\">\n  <mds-text truncate=\"word\" typography=\"h6\">Alert configurazione</mds-text>\n</mds-entity>\n```\n\n#### Await / Loading State\n\nSet the `await` boolean attribute while the entity data is being fetched. The avatar is hidden and a spinner appears in its place. Remove the attribute when loading is complete - do not set `await=\"false\"`.\n\n```html\n<mds-entity await icon=\"mi/baseline/done\" variant=\"success\">\n  <mds-text truncate=\"word\" typography=\"h6\">Caricamento in corso...</mds-text>\n  <mds-text truncate=\"word\" slot=\"detail\" typography=\"caption\">Attendere prego</mds-text>\n</mds-entity>\n```\n\n#### Upload / Async Workflow\n\nCombine `await` with `icon` and `variant` to drive a state machine: show the spinner while uploading, then reveal the result icon when done.\n\n```html\n<!-- While uploading -->\n<mds-entity await>\n  <mds-text truncate=\"word\" typography=\"h6\">Report finanziario 2024.docx</mds-text>\n  <mds-text truncate=\"word\" slot=\"detail\" typography=\"caption\">Upload in corso...</mds-text>\n  <mds-button slot=\"action\" icon=\"mi/baseline/cancel\" variant=\"light\" title=\"Annulla upload\"></mds-button>\n</mds-entity>\n\n<!-- After success -->\n<mds-entity icon=\"mi/baseline/done\" variant=\"success\" tone=\"weak\">\n  <mds-text truncate=\"word\" typography=\"h6\">Report finanziario 2024.docx</mds-text>\n  <mds-text truncate=\"word\" slot=\"detail\" typography=\"caption\">Upload completato con successo</mds-text>\n</mds-entity>\n```\n\n#### Styling Customization\n\nStyle the entity only through its public `--mds-entity-*` CSS custom properties. Set them on the host or a parent selector; use the semantic color roles via `rgb(var(--magma-<role>))` so dark mode and high-contrast modes keep working. The avatar takes its colours from `variant` and `tone`, not from a custom property.\n\n```css\n.entity-highlight mds-entity {\n  --mds-entity-background: rgb(var(--magma-accent-surface));\n  --mds-entity-color: rgb(var(--magma-accent-fg));\n}\n```\n\n#### Spacing Between the Name and the Details\n\nThe name and the `detail` row stack in the `infos` part, 2px apart, so a badge or a caption in `detail` never touches the name. When a layout needs more room between them, set the gap of the part; the nodes inside it are not API.\n\n```css\n.entity-roomy mds-entity::part(infos) {\n  gap: calc(var(--spacing) * 100);\n}\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-entity>`. 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 the Name as a Plain Text String in the Default Slot\n\nThe default slot accepts HTML elements and components, and the component applies truncation to slotted nodes. Passing a bare string bypasses `<mds-text>` typography tokens and truncation utilities; the result may overflow or render with inconsistent styles.\n\n```html\n<!-- INCORRECT -->\n<mds-entity src=\"/avatars/mario-rossi.png\">\n  Mario Rossi\n</mds-entity>\n\n<!-- CORRECT -->\n<mds-entity src=\"/avatars/mario-rossi.png\">\n  <mds-text truncate=\"word\" typography=\"h6\">Mario Rossi</mds-text>\n</mds-entity>\n```\n\n#### Do Not Use `await=\"false\"` to Cancel the Loading State\n\n`await` is a boolean attribute: turn it off by removing it (or setting the prop to `undefined`), as for every boolean ([`agents/mistakes.md`](../../../../agents/mistakes.md)). The runtime happens to read the string `\"false\"` as `false`, but the attribute stays in the markup until the component renders, and HTML, `[await]` selectors and `hasAttribute()` read a present attribute as set.\n\n```html\n<!-- INCORRECT -->\n<mds-entity await=\"false\" src=\"/avatars/mario-rossi.png\">\n  <mds-text truncate=\"word\" typography=\"h6\">Mario Rossi</mds-text>\n</mds-entity>\n\n<!-- CORRECT -->\n<mds-entity src=\"/avatars/mario-rossi.png\">\n  <mds-text truncate=\"word\" typography=\"h6\">Mario Rossi</mds-text>\n</mds-entity>\n```\n\n#### Do Not Put Non-Button Elements in the `action` Slot\n\nThe `action` slot is sized and spaced for icon-only `<mds-button>` elements. Projecting arbitrary elements (raw `<button>`, `<a>`, large widgets) breaks the fixed square dimensions applied by `::slotted([slot='action'])`.\n\n```html\n<!-- INCORRECT -->\n<mds-entity src=\"/avatars/mario-rossi.png\">\n  <mds-text truncate=\"word\" typography=\"h6\">Mario Rossi</mds-text>\n  <button slot=\"action\">Modifica</button>\n</mds-entity>\n\n<!-- CORRECT -->\n<mds-entity src=\"/avatars/mario-rossi.png\">\n  <mds-text truncate=\"word\" typography=\"h6\">Mario Rossi</mds-text>\n  <mds-button slot=\"action\" icon=\"mdi/pencil\" variant=\"primary\" tone=\"strong\" title=\"Modifica\"></mds-button>\n</mds-entity>\n```\n\n#### Do Not Combine `src`, `icon`, and `initials` Expecting All Three to Show\n\nThe component resolves to a single avatar representation. Setting all three does not create a layered avatar: the inner `mds-avatar` lets `icon` hide the image, `initials` hide the icon and `src` hide the initials, so the chip renders none of them.\n\n```html\n<!-- INCORRECT (expects image, icon, and initials to all appear) -->\n<mds-entity src=\"/avatars/mario-rossi.png\" icon=\"mi/baseline/person\" initials=\"mr\">\n  <mds-text truncate=\"word\" typography=\"h6\">Mario Rossi</mds-text>\n</mds-entity>\n\n<!-- CORRECT - provide the most specific source available -->\n<mds-entity src=\"/avatars/mario-rossi.png\">\n  <mds-text truncate=\"word\" typography=\"h6\">Mario Rossi</mds-text>\n</mds-entity>\n```\n\n#### Do Not Apply an Invalid `tone` Value\n\n`<mds-entity>` uses `ToneMinimalVariantType`, which accepts only `strong` and `weak`. Passing other tone values like `outline` or `text` is a type error and is silently ignored: the avatar renders with the `strong` colours.\n\n```html\n<!-- INCORRECT -->\n<mds-entity icon=\"mi/baseline/business\" variant=\"primary\" tone=\"outline\">\n  <mds-text truncate=\"word\" typography=\"h6\">Divisione Commerciale</mds-text>\n</mds-entity>\n\n<!-- CORRECT -->\n<mds-entity icon=\"mi/baseline/business\" variant=\"primary\" tone=\"strong\">\n  <mds-text truncate=\"word\" typography=\"h6\">Divisione Commerciale</mds-text>\n</mds-entity>\n```\n\n#### Do Not Pierce the Shadow DOM to Style the Avatar\n\nThe component exposes a `::part(avatar)` surface for styling the inner `<mds-avatar>`, but the part is the limit: the nodes inside it are not API. Color the avatar with the `variant` and `tone` props, and the entity with its public `--mds-entity-background` and `--mds-entity-color` custom properties; do not target undocumented internals.\n\n```css\n/* INCORRECT */\nmds-entity::part(avatar) .inner-circle {\n  background: hotpink;\n}\nmds-entity >>> mds-avatar {\n  width: 80px;\n}\n\n/* CORRECT */\nmds-entity {\n  --mds-entity-background: rgb(var(--magma-accent-surface));\n  --mds-entity-color: rgb(var(--magma-accent-fg));\n}\n```\n\n```html\n<!-- CORRECT -->\n<mds-entity icon=\"mi/baseline/business\" variant=\"primary\" tone=\"weak\">\n  <mds-text truncate=\"word\" typography=\"h6\">Divisione Commerciale</mds-text>\n</mds-entity>\n```\n"
      },
      "props": [
        {
          "name": "await",
          "type": "boolean | undefined",
          "complexType": {
            "original": "boolean",
            "resolved": "boolean | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "await",
          "reflectToAttr": true,
          "docs": "Specifies if the component is awaiting a response from an external resource",
          "docsTags": [],
          "values": [
            {
              "type": "boolean"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "icon",
          "type": "string | undefined",
          "complexType": {
            "original": "string",
            "resolved": "string | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "icon",
          "reflectToAttr": true,
          "docs": "Specifies the icon to be displayed if src propery is not used",
          "docsTags": [],
          "values": [
            {
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "initials",
          "type": "string | undefined",
          "complexType": {
            "original": "string",
            "resolved": "string | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "initials",
          "reflectToAttr": true,
          "docs": "The user's inizials displayed if there's no image available and icon is not set",
          "docsTags": [],
          "values": [
            {
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "src",
          "type": "string | undefined",
          "complexType": {
            "original": "string",
            "resolved": "string | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "src",
          "reflectToAttr": true,
          "docs": "Specifies the path to the image",
          "docsTags": [],
          "values": [
            {
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "tone",
          "type": "\"strong\" | \"weak\" | undefined",
          "complexType": {
            "original": "ToneMinimalVariantType",
            "resolved": "\"strong\" | \"weak\" | undefined",
            "references": {
              "ToneMinimalVariantType": {
                "location": "import",
                "path": "@type/tone",
                "id": "src/type/tone.ts::ToneMinimalVariantType",
                "referenceLocation": "ToneMinimalVariantType"
              }
            }
          },
          "mutable": false,
          "attr": "tone",
          "reflectToAttr": true,
          "docs": "Specifies the color tone of the component",
          "docsTags": [],
          "values": [
            {
              "value": "strong",
              "type": "string"
            },
            {
              "value": "weak",
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "variant",
          "type": "\"amaranth\" | \"aqua\" | \"blue\" | \"error\" | \"green\" | \"info\" | \"lime\" | \"orange\" | \"orchid\" | \"primary\" | \"purple\" | \"red\" | \"sky\" | \"success\" | \"violet\" | \"warning\" | \"yellow\" | undefined",
          "complexType": {
            "original": "ThemeFullVariantAvatarType",
            "resolved": "\"amaranth\" | \"aqua\" | \"blue\" | \"error\" | \"green\" | \"info\" | \"lime\" | \"orange\" | \"orchid\" | \"primary\" | \"purple\" | \"red\" | \"sky\" | \"success\" | \"violet\" | \"warning\" | \"yellow\" | undefined",
            "references": {
              "ThemeFullVariantAvatarType": {
                "location": "import",
                "path": "@type/variant",
                "id": "src/type/variant.ts::ThemeFullVariantAvatarType",
                "referenceLocation": "ThemeFullVariantAvatarType"
              }
            }
          },
          "mutable": false,
          "attr": "variant",
          "reflectToAttr": true,
          "docs": "Specifies the color variant of the component",
          "docsTags": [],
          "values": [
            {
              "value": "amaranth",
              "type": "string"
            },
            {
              "value": "aqua",
              "type": "string"
            },
            {
              "value": "blue",
              "type": "string"
            },
            {
              "value": "error",
              "type": "string"
            },
            {
              "value": "green",
              "type": "string"
            },
            {
              "value": "info",
              "type": "string"
            },
            {
              "value": "lime",
              "type": "string"
            },
            {
              "value": "orange",
              "type": "string"
            },
            {
              "value": "orchid",
              "type": "string"
            },
            {
              "value": "primary",
              "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-entity-background",
          "annotation": "prop",
          "docs": "The background-color of the entity",
          "visibility": "public"
        },
        {
          "name": "--mds-entity-color",
          "annotation": "prop",
          "docs": "The color of the entity name",
          "visibility": "public"
        },
        {
          "name": "--mds-entity-detail-color",
          "annotation": "prop",
          "docs": "The color of the text details",
          "visibility": "internal"
        },
        {
          "name": "--mds-entity-icon-background",
          "annotation": "prop",
          "docs": "The background-color of the icon",
          "visibility": "internal"
        },
        {
          "name": "--mds-entity-icon-color",
          "annotation": "prop",
          "docs": "The color of the icon",
          "visibility": "internal"
        }
      ],
      "slots": [
        {
          "name": "",
          "docs": "Add `text string`, `HTML elements` or `components` to this slot."
        },
        {
          "name": "action",
          "docs": "Add `HTML elements` or `components`, it is **recommended** to use `mds-button` element."
        },
        {
          "name": "detail",
          "docs": "Add `HTML elements` or `components` to this slot."
        }
      ],
      "parts": [
        {
          "name": "avatar",
          "docs": "The avatar element"
        },
        {
          "name": "infos",
          "docs": "The column that stacks the name (default slot) and the `detail` row"
        },
        {
          "name": "spinner",
          "docs": "The spinner element"
        }
      ],
      "states": [],
      "dependents": [],
      "dependencies": [
        "mds-spinner",
        "mds-avatar"
      ],
      "dependencyGraph": {
        "mds-entity": [
          "mds-spinner",
          "mds-avatar"
        ],
        "mds-avatar": [
          "mds-img",
          "mds-icon"
        ],
        "mds-img": [
          "mds-icon",
          "mds-text",
          "mds-button"
        ],
        "mds-button": [
          "mds-icon",
          "mds-spinner",
          "mds-text"
        ]
      },
      "storybook": "ui-entity--docs"
    }
  ]
}
