{
  "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-notification/mds-notification.tsx",
      "encapsulation": "shadow",
      "tag": "mds-notification",
      "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": "category",
          "text": "feedback"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-notification>` web component is a numeric badge/dot indicator of the Magma Design System that attaches to another element (an icon, a button, an avatar) to signal a count of pending items. It has no HTML primitive equivalent: it positions itself relative to a target element rather than wrapping content of its own.\n\n#### Semantic Behavior\n\n- **Target attachment**: The component anchors to the element matched by the `target` selector and tracks it as it scrolls or resizes.\n- **Missing target falls back**: If `target` is not set, positioning is disabled; if `target` is set but resolves to no element, it logs a console warning (`mds-notification: no valid target found`) and falls back to `strategy=\"disabled\"` as well.\n- **Zero value**: When `value` is `0` the badge renders without a number, as a plain dot; it is not hidden.\n- **Count overflow**: When `max` is set and `value` exceeds it, the displayed text becomes `+max` (e.g. `+9`) instead of the raw number; otherwise the value is locale-formatted.\n- **Pulse**: With `pulse`, the dot calls attention when `value` grows: a ring grows from it and fades, three beats and then still (3 seconds, under the 5 of WCAG 2.2.2). It never plays on the first render, nor when the count goes down, nor with a reduced animation (`pref-animation=\"reduce\"`, or the reduced motion of the system); a growth while it plays does not start it over.\n- **Accessibility**: The count describes the target (`aria-describedby` on it, next to the descriptions it already has), so a screen reader reads it with the element it sits on; the badge itself is then hidden from assistive technologies, or the count would be read twice. A dismissed badge, a plain dot and a target in another shadow tree describe nothing. Without a target the count is plain text, read with whatever contains it (the name of the `mds-button` it sits in).\n\n#### Properties & Visual Configurations\n\n- **`target`** is the CSS selector of the element the badge anchors to; it is effectively mandatory for positioned rendering.\n- **`value`** is the count shown in the badge and also the description of the target; `0` shows a plain dot without a number.\n- **`max`** caps the visible number - pick it when raw counts could grow large and you want a compact `+N` ceiling.\n- **`variant`** is the colour of the dot and of the badge, a status (`docs/agents/variants.md`): `error`, the danger colour, by default; `info` for something new that is not wrong, such as the items others added to a list; `success` and `warning`. The ink of the count follows the fill.\n- **`pulse`** makes the dot pulse when its count grows; leave it off on a count that grows all the time, where every message would call attention.\n- **`dismissed`** hides the badge independently of its value (the badge is shown by default): with the floating strategies (`fixed`, `absolute`) it scales out, with `disabled` it is taken out of the layout at once.\n\n#### Other behavioral props\n\n- **`strategy`** selects the positioning mode (`'fixed'` by default, `'absolute'`, or `'disabled'`). Use `'disabled'` to opt out of dynamic tracking; it is also set automatically when no `target` is provided.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-notification>` component, ordered from most common to most specialized. The examples assume a working knowledge of the shared component rules in [`agents/conventions.md`](../../../../agents/conventions.md).\n\n#### Badge Inside `mds-button` via Named Slot\n\nThe most common usage. Drop `<mds-notification>` into the `notification` slot of [`mds-button`](../mds-button/AGENTS.md) so the badge is positioned and animated automatically by the button's internal layout. Set `strategy=\"disabled\"` because the button handles placement (without a `target` the component also switches to it by itself); the component is no longer responsible for floating positioning.\n\n```html\n<mds-button label=\"Messaggi\" icon=\"mdi/email\" variant=\"primary\" tone=\"weak\">\n  <mds-notification slot=\"notification\" value=\"5\" strategy=\"disabled\"></mds-notification>\n</mds-button>\n```\n\n#### Floating Badge Anchored to an Arbitrary Element\n\nUse the `target` prop with a CSS selector to attach a floating badge to any element on the page. The component uses `position: fixed` by default and tracks the target through scroll and resize automatically.\n\n```html\n<mds-notification target=\"#icona-notifiche\" value=\"12\"></mds-notification>\n<mds-icon id=\"icona-notifiche\" name=\"mi/baseline/notifications\"></mds-icon>\n```\n\n#### Count Overflow via `max`\n\nWhen raw counts can grow large, set `max` to cap the visible number. Values above the cap display as `+max` (e.g. `+99`), keeping the badge compact.\n\n```html\n<mds-notification target=\"#posta-in-arrivo\" value=\"127\" max=\"99\"></mds-notification>\n<mds-icon id=\"posta-in-arrivo\" name=\"mi/baseline/mail\"></mds-icon>\n```\n\n#### Hiding and Showing the Badge\n\nAdd the `dismissed` prop to hide the badge independently of its count. This is useful when the notification state is known but should not be displayed yet - for example while a panel is already open.\n\n```html\n<!-- Badge nascosto anche se ha un valore -->\n<mds-notification target=\"#avatar-utente\" value=\"3\" dismissed></mds-notification>\n\n<!-- Badge visibile (valore predefinito) -->\n<mds-notification target=\"#avatar-utente\" value=\"3\"></mds-notification>\n```\n\n#### Zero Value Produces an Empty Dot\n\nWhen `value` is `0` the badge renders without a number, appearing as a plain dot. Use this when you need an unread marker without a count - for example to signal new activity without exposing a specific number.\n\n```html\n<mds-notification target=\"#attivita-recente\" value=\"0\"></mds-notification>\n<mds-button id=\"attivita-recente\" label=\"Attivita\" variant=\"primary\" tone=\"weak\"></mds-button>\n```\n\n#### Info Dot That Pulses When the Count Grows, in a Line of Text\n\nUse `variant=\"info\"` with `pulse` to call attention to new items without moving anything on screen, such as the items others added to a list while the person works through it. Without a `target` the badge sits in the line, and its count is read with the words around it: keep it inside the text that says what is new, the one with `role=\"status\"`, so the number is read out when it changes, and the action outside it. The dot pulses each time `value` grows, three beats and then still.\n\n```html\n<div class=\"flex items-center gap-200\">\n  <p role=\"status\" class=\"flex items-center gap-100\">\n    <mds-notification variant=\"info\" value=\"3\" pulse></mds-notification>\n    <mds-text typography=\"detail\">nuove pratiche</mds-text>\n  </p>\n  <mds-button variant=\"info\" tone=\"outline\" size=\"sm\">Mostra</mds-button>\n</div>\n```\n\n```js\n// the count grows: the dot pulses\ndocument.querySelector('mds-notification').value = 5;\n```\n\n#### Absolute Positioning Strategy\n\nUse `strategy=\"absolute\"` when the badge must be positioned relative to a scrolling container rather than the viewport. The target element must have `position: relative` (or another non-static position) set on its nearest containing block.\n\n```html\n<div style=\"position: relative; overflow: auto;\">\n  <mds-notification target=\"#elemento-lista\" value=\"2\" strategy=\"absolute\"></mds-notification>\n  <mds-button id=\"elemento-lista\" label=\"Documenti\" variant=\"primary\"></mds-button>\n</div>\n```\n\n#### Disabled Strategy for Manual Placement\n\nUse `strategy=\"disabled\"` when you want to position the badge yourself with utility classes or CSS instead of delegating to the floating-UI engine. This is the right choice whenever the badge lives inside a slot (the slot's host already controls layout) or when you use Tailwind position utilities.\n\n```html\n<mds-button label=\"Avvisi\" icon=\"mi/baseline/notifications\" variant=\"primary\" tone=\"strong\">\n  <mds-notification\n    slot=\"notification\"\n    value=\"4\"\n    strategy=\"disabled\"\n  ></mds-notification>\n</mds-button>\n```\n\n#### Styling Customization via CSS Custom Properties\n\nCustomize the badge only through its public `--mds-notification-*` CSS custom properties, the ink color and the size; the fill and the ring of the dot come from the component, the fill from its `variant`. Set them on the host element or a parent selector. Use the Magma color tokens with `rgb(var(--<token>))` so dark mode and high-contrast stay consistent.\n\n```css\n/* Badge piu' grande, inchiostro abbinato al riempimento di stato */\n.header-nav mds-notification {\n  --mds-notification-color: rgb(var(--magma-danger-on-emphasis));\n  --mds-notification-size: 18px;\n}\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-notification>`. 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 Use a Floating Strategy When Slotted Inside `mds-button`\n\nWhen `<mds-notification>` sits inside the `notification` slot of [`mds-button`](../mds-button/AGENTS.md), the button's own layout handles placement. Without a `target` the component switches itself to `strategy=\"disabled\"`; giving it a `target` turns floating positioning back on, so the badge escapes the slot and positions itself relative to the viewport instead.\n\n```html\n<!-- INCORRECT -->\n<mds-button id=\"btn-messaggi\" label=\"Messaggi\" icon=\"mdi/email\" variant=\"primary\">\n  <mds-notification slot=\"notification\" target=\"#btn-messaggi\" value=\"5\"></mds-notification>\n</mds-button>\n\n<!-- CORRECT -->\n<mds-button id=\"btn-messaggi\" label=\"Messaggi\" icon=\"mdi/email\" variant=\"primary\">\n  <mds-notification slot=\"notification\" value=\"5\" strategy=\"disabled\"></mds-notification>\n</mds-button>\n```\n\n#### Do Not Omit `target` When Using a Floating Strategy\n\nWithout `target`, the component cannot locate its anchor, automatically falls back to `strategy=\"disabled\"`, and renders in document flow wherever the tag appears - usually in the wrong place.\n\n```html\n<!-- INCORRECT -->\n<mds-notification value=\"3\"></mds-notification>\n<mds-icon id=\"icona-posta\" name=\"mi/baseline/mail\"></mds-icon>\n\n<!-- CORRECT -->\n<mds-notification target=\"#icona-posta\" value=\"3\"></mds-notification>\n<mds-icon id=\"icona-posta\" name=\"mi/baseline/mail\"></mds-icon>\n```\n\n#### Do Not Use `<mds-notification>` as a Status Dot Without a Count\n\n`<mds-notification>` is a numeric counter badge. For a purely visual status indicator with no count, use [`mds-badge`](../mds-badge/AGENTS.md) instead, which is designed for short status labels.\n\n```html\n<!-- INCORRECT - abusing notification as a plain dot indicator -->\n<mds-notification target=\"#utente-online\" value=\"0\"></mds-notification>\n\n<!-- CORRECT - use mds-badge for status dots -->\n<mds-badge variant=\"success\" label=\"Online\"></mds-badge>\n```\n\n#### Do Not Animate the Dot Yourself\n\nA pulse written by the page, with a keyframe, a scale and an opacity of its own, ignores the animation preference and never stops. `pulse` plays three beats when the count grows, and none with a reduced animation.\n\n```html\n<!-- INCORRECT -->\n<mds-notification class=\"animate-ping\" variant=\"info\" value=\"3\"></mds-notification>\n\n<!-- CORRECT -->\n<mds-notification variant=\"info\" value=\"3\" pulse></mds-notification>\n```\n\n#### Do Not Wrap the Target in a Relative Container and Use `strategy=\"fixed\"`\n\n`strategy=\"fixed\"` anchors the badge to the viewport coordinate system. If the target sits inside a CSS-transformed or `position: relative` parent, `fixed` positioning will not track it correctly. Switch to `strategy=\"absolute\"` and ensure the containing block has a non-static position.\n\n```html\n<!-- INCORRECT - fixed badge inside transformed container -->\n<div style=\"transform: translateX(0);\">\n  <mds-notification target=\"#btn-azioni\" value=\"2\" strategy=\"fixed\"></mds-notification>\n  <mds-button id=\"btn-azioni\" label=\"Azioni\"></mds-button>\n</div>\n\n<!-- CORRECT - absolute strategy with positioned containing block -->\n<div style=\"position: relative;\">\n  <mds-notification target=\"#btn-azioni\" value=\"2\" strategy=\"absolute\"></mds-notification>\n  <mds-button id=\"btn-azioni\" label=\"Azioni\"></mds-button>\n</div>\n```\n\n#### Do Not Pierce Shadow DOM to Style the Inner Dot\n\nThe internal `.dot` element is not a documented `::part()`. Targeting it with `::part(dot)` or deep-selector hacks breaks on any internal refactor. The dot keeps the fill the component gives it, from its `variant`: adjust only what the public `--mds-notification-color` and `--mds-notification-size` CSS custom properties expose.\n\n```css\n/* INCORRECT */\nmds-notification::part(dot) {\n  background-color: purple;\n}\n\n/* CORRECT */\nmds-notification {\n  --mds-notification-size: calc(var(--spacing) * 600);\n}\n```\n"
      },
      "props": [
        {
          "name": "dismissed",
          "type": "boolean",
          "complexType": {
            "original": "boolean",
            "resolved": "boolean",
            "references": {}
          },
          "mutable": true,
          "attr": "dismissed",
          "reflectToAttr": true,
          "docs": "Specifies if the notification is dismissed",
          "docsTags": [
            {
              "name": "default",
              "text": "false"
            }
          ],
          "default": "false",
          "values": [
            {
              "type": "boolean"
            }
          ],
          "optional": false,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "max",
          "type": "number | undefined",
          "complexType": {
            "original": "number",
            "resolved": "number | undefined",
            "references": {}
          },
          "mutable": false,
          "attr": "max",
          "reflectToAttr": true,
          "docs": "Specifies the maximum number that can be seen, assuming that the number is for example 9 and that this is exceeded with 15, the component shows +9",
          "docsTags": [],
          "values": [
            {
              "type": "number"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "pulse",
          "type": "boolean",
          "complexType": {
            "original": "boolean",
            "resolved": "boolean",
            "references": {}
          },
          "mutable": false,
          "attr": "pulse",
          "reflectToAttr": false,
          "docs": "Specifies if the dot pulses when `value` grows: a ring that grows from it and fades, three\nbeats and then still. Never on the first render, nor with a reduced animation",
          "docsTags": [
            {
              "name": "default",
              "text": "false"
            }
          ],
          "default": "false",
          "values": [
            {
              "type": "boolean"
            }
          ],
          "optional": false,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "strategy",
          "type": "\"absolute\" | \"disabled\" | \"fixed\"",
          "complexType": {
            "original": "StrategyType",
            "resolved": "\"absolute\" | \"disabled\" | \"fixed\"",
            "references": {
              "StrategyType": {
                "location": "import",
                "path": "./meta/types",
                "id": "src/components/mds-notification/meta/types.ts::StrategyType",
                "referenceLocation": "StrategyType"
              }
            }
          },
          "mutable": true,
          "attr": "strategy",
          "reflectToAttr": true,
          "docs": "Specifies the position strategy of the notification",
          "docsTags": [
            {
              "name": "default",
              "text": "'fixed'"
            }
          ],
          "default": "'fixed'",
          "values": [
            {
              "value": "absolute",
              "type": "string"
            },
            {
              "value": "disabled",
              "type": "string"
            },
            {
              "value": "fixed",
              "type": "string"
            }
          ],
          "optional": false,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "target",
          "type": "string",
          "complexType": {
            "original": "string",
            "resolved": "string",
            "references": {}
          },
          "mutable": false,
          "attr": "target",
          "reflectToAttr": false,
          "docs": "Specifies the selector of the target element, this attribute is used with `querySelector` method.",
          "docsTags": [
            {
              "name": "example",
              "text": "'#profile-button'"
            }
          ],
          "values": [
            {
              "type": "string"
            }
          ],
          "optional": false,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "value",
          "type": "number",
          "complexType": {
            "original": "number",
            "resolved": "number",
            "references": {}
          },
          "mutable": true,
          "attr": "value",
          "reflectToAttr": true,
          "docs": "Specifies the number of notifications to display. At 0 the badge shows no number, as an\nempty dot: it is not hidden, `dismissed` takes it off its target",
          "docsTags": [
            {
              "name": "default",
              "text": "0"
            }
          ],
          "default": "0",
          "values": [
            {
              "type": "number"
            }
          ],
          "optional": false,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "variant",
          "type": "\"error\" | \"info\" | \"success\" | \"warning\"",
          "complexType": {
            "original": "ThemeStatusVariantType",
            "resolved": "\"error\" | \"info\" | \"success\" | \"warning\"",
            "references": {
              "ThemeStatusVariantType": {
                "location": "import",
                "path": "@type/variant",
                "id": "src/type/variant.ts::ThemeStatusVariantType",
                "referenceLocation": "ThemeStatusVariantType"
              }
            }
          },
          "mutable": false,
          "attr": "variant",
          "reflectToAttr": true,
          "docs": "Specifies the colour of the dot and of the badge, a status: `error`, the danger colour, by\ndefault; `info` for something new that is not wrong, `success` and `warning`",
          "docsTags": [
            {
              "name": "default",
              "text": "'error'"
            }
          ],
          "default": "'error'",
          "values": [
            {
              "value": "error",
              "type": "string"
            },
            {
              "value": "info",
              "type": "string"
            },
            {
              "value": "success",
              "type": "string"
            },
            {
              "value": "warning",
              "type": "string"
            }
          ],
          "optional": false,
          "required": false,
          "getter": false,
          "setter": false
        }
      ],
      "methods": [],
      "events": [],
      "listeners": [],
      "styles": [
        {
          "name": "--mds-notification-color",
          "annotation": "prop",
          "docs": "The text/icon color of the notification component.",
          "visibility": "public"
        },
        {
          "name": "--mds-notification-dot-background",
          "annotation": "prop",
          "docs": "The background color of the notification dot.",
          "visibility": "internal"
        },
        {
          "name": "--mds-notification-dot-padding",
          "annotation": "prop",
          "docs": "The padding around the notification dot.",
          "visibility": "internal"
        },
        {
          "name": "--mds-notification-min-width",
          "annotation": "prop",
          "docs": "The minimum width of the notification component.",
          "visibility": "internal"
        },
        {
          "name": "--mds-notification-pulse-duration",
          "annotation": "prop",
          "docs": "Duration of one beat of the pulse.",
          "visibility": "internal"
        },
        {
          "name": "--mds-notification-pulse-spread",
          "annotation": "prop",
          "docs": "How far the ring of the pulse grows past the ring of the dot.",
          "visibility": "internal"
        },
        {
          "name": "--mds-notification-ring-color",
          "annotation": "prop",
          "docs": "The color of the notification ring.",
          "visibility": "internal"
        },
        {
          "name": "--mds-notification-ring-size",
          "annotation": "prop",
          "docs": "The thickness of the notification ring.",
          "visibility": "internal"
        },
        {
          "name": "--mds-notification-size",
          "annotation": "prop",
          "docs": "The base size of the notification element.",
          "visibility": "public"
        },
        {
          "name": "--mds-notification-transition-duration",
          "annotation": "prop",
          "docs": "Duration of notification transitions.",
          "visibility": "internal"
        },
        {
          "name": "--mds-notification-transition-timing-function",
          "annotation": "prop",
          "docs": "Timing function for notification transitions.",
          "visibility": "internal"
        },
        {
          "name": "--mds-notification-translate",
          "annotation": "prop",
          "docs": "The CSS transform applied for notification positioning.",
          "visibility": "internal"
        },
        {
          "name": "--mds-notification-translate-offset-x",
          "annotation": "prop",
          "docs": "X-axis offset factor for notification translation.",
          "visibility": "internal"
        },
        {
          "name": "--mds-notification-translate-offset-y",
          "annotation": "prop",
          "docs": "Y-axis offset factor for notification translation.",
          "visibility": "internal"
        }
      ],
      "slots": [],
      "parts": [],
      "states": [],
      "dependents": [],
      "dependencies": [
        "mds-text"
      ],
      "dependencyGraph": {
        "mds-notification": [
          "mds-text"
        ]
      },
      "storybook": "ui-notification--docs"
    }
  ]
}
