{
  "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-toast-region/mds-toast-region.tsx",
      "encapsulation": "shadow",
      "tag": "mds-toast-region",
      "docs": "",
      "docsTags": [
        {
          "name": "slot",
          "text": "- Add `mds-toast` elements, one per message: the region lines up the visible ones at its edge."
        },
        {
          "name": "category",
          "text": "feedback"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-toast-region>` web component is the place where an application shows its toasts: placed once in the application shell, at an edge of the viewport, it lines up the `<mds-toast>` elements visible at the same time, each one readable, and announces them to assistive technologies. It has no native HTML equivalent.\n\n#### Semantic Behavior\n\n- **One place for the toasts**: The region is fixed at the edge named by `position`; the toasts inside it are laid out in its flow, in a column with a gap, instead of each one being fixed on its own. The newest toast (the last one in the page) sits at the edge, where the toasts come in.\n- **The others close the gap**: A hidden toast in the region takes no room once its exit is over, so the toasts left move up to the edge; the exit itself is a short fade towards the edge, not a slide over the other toasts.\n- **Position of the toasts**: The region gives its `position` to every toast inside it, the ones added later too, and again when its own `position` changes.\n- **Live region**: The host is a status region (`role=\"status\"`, `aria-live=\"polite\"`, not atomic) that is in the page before any message, so a toast added or shown inside it is read out without moving the focus, and only that toast. The toasts inside it drop their own status role.\n- **The most toasts at once**: When a toast shows while `max` toasts are already visible, the region hides the oldest ones with a `duration`, in the order they were shown, and each one emits `mdsToastClose` with `reason: 'hide'`. A toast that stays (`duration=\"0\"`) and the toast just shown are never hidden, so the region may hold more than `max` until one of them goes.\n- **Below the dialogs**: The region is a fixed layer of the page, not a top layer element: an `<mds-modal>` opened later covers it and makes it inert, toasts and announcements included. A message about an open dialog belongs inside the dialog.\n- **Toasts outside the region**: A toast that is not inside a region keeps placing itself at its own `position`, as before.\n\n#### Properties & Visual Configurations\n\n- **`position`** picks the edge and the alignment of the column: top or bottom, left, center or right. Pick the edge where the application expects transient feedback; one region per application is the rule.\n- **`max`** is how many toasts may be visible at once before the oldest one with a timer leaves to make room; keep it small, a column of toasts covers the page.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-toast-region>` component, ordered from most common to most specialized. The toasts follow the examples of `<mds-toast>`; the shared component rules live in [`agents/conventions.md`](../../../../agents/conventions.md).\n\n#### One Region in the Application Shell\n\nThe region holds the `<mds-toast>` elements of the application: every toast of the application goes into it, and the region lines them up at its edge and announces them. A toast shown in it leaves after its `duration`.\n\n```html\n<mds-toast-region>\n  <mds-toast visible variant=\"success\">Documento salvato</mds-toast>\n</mds-toast-region>\n```\n\nPlace one region in the shell of the application, outside the content that changes from page to page, so it is in the page before any message; the toasts are added to it from code (see the next pattern).\n\n```html\n<body>\n  <main>\n    <!-- contenuto dell'applicazione -->\n  </main>\n  <mds-toast-region></mds-toast-region>\n</body>\n```\n\n#### Showing a Toast From Code\n\nCreate the toast, append it to the region and show it; remove it from the page once it has closed. The region places it, announces it, and makes room for it.\n\n```javascript\nconst region = document.querySelector('mds-toast-region');\n\nconst showToast = (text, variant = 'success') => {\n  const toast = document.createElement('mds-toast');\n  toast.variant = variant;\n  toast.textContent = text;\n  toast.addEventListener('mdsToastClose', () => toast.remove());\n  region.append(toast);\n  toast.visible = true;\n};\n\nshowToast('Documento salvato');\n```\n\n#### A Message That Stays Among Confirmations\n\nAn error that the person must act on stays (`duration=\"0\"`) with its action and the hide button, while the confirmations around it come and go: the region never hides a toast that stays to make room.\n\n```html\n<mds-toast-region>\n  <mds-toast visible variant=\"error\" duration=\"0\" dismissible>\n    Invio non riuscito\n    <mds-button slot=\"action\" size=\"sm\" variant=\"error\" tone=\"weak\">Riprova</mds-button>\n  </mds-toast>\n  <mds-toast visible variant=\"success\">Bozza salvata</mds-toast>\n</mds-toast-region>\n```\n\n#### At the Top Edge\n\nSet `position` on the region, not on the toasts: it lines the toasts up at that edge, the newest one at the top, and gives them the position, so they come in and leave from that edge.\n\n```html\n<mds-toast-region position=\"top-right\"></mds-toast-region>\n```\n\n#### Fewer Toasts at Once\n\nLower `max` for an application with frequent confirmations or little room: when one more toast shows, the oldest one with a timer leaves first.\n\n```html\n<mds-toast-region max=\"2\"></mds-toast-region>\n```\n\n#### Spacing Between the Toasts\n\nChange the space between the toasts with `--mds-toast-region-gap`.\n\n```css\nmds-toast-region {\n  --mds-toast-region-gap: 12px;\n}\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-toast-region>`. Each entry pairs the wrong form with the right one and a one-line reason. System-wide rules live in [`agents/mistakes.md`](../../../../agents/mistakes.md) - they apply here too but are not repeated.\n\n#### Do Not Place a Region in Every Page or Component\n\nTwo regions at the same edge draw their toasts at the same place, one over the other, which is the problem the region solves. A region created together with its message is also not in the page before it, so the message may not be announced.\n\n```html\n<!-- INCORRECT - one region per form, created with the message -->\n<form>\n  <mds-toast-region>\n    <mds-toast visible>Modulo inviato</mds-toast>\n  </mds-toast-region>\n</form>\n\n<!-- CORRECT - one region in the shell, the toasts appended to it -->\n<mds-toast-region></mds-toast-region>\n```\n\n#### Do Not Set `position` on the Toasts Inside a Region\n\nThe region gives its `position` to every toast inside it, so the one set on a toast is replaced. Set it on the region.\n\n```html\n<!-- INCORRECT - replaced by the region -->\n<mds-toast-region>\n  <mds-toast visible position=\"top-right\">Impostazioni aggiornate</mds-toast>\n</mds-toast-region>\n\n<!-- CORRECT -->\n<mds-toast-region position=\"top-right\">\n  <mds-toast visible>Impostazioni aggiornate</mds-toast>\n</mds-toast-region>\n```\n\n#### Do Not Send a Message About an Open Dialog to the Region\n\nWhile an `mds-modal` is open, everything outside it is inert, the region included: its toast cannot be used and is not announced. Show the message inside the dialog.\n\n```html\n<!-- INCORRECT - the error of the dialog goes behind it -->\n<mds-modal opened>\n  <form>...</form>\n</mds-modal>\n<mds-toast-region>\n  <mds-toast visible variant=\"error\" duration=\"0\">Salvataggio non riuscito</mds-toast>\n</mds-toast-region>\n\n<!-- CORRECT - the error is in the dialog -->\n<mds-modal opened>\n  <mds-banner variant=\"error\">Salvataggio non riuscito</mds-banner>\n  <form></form>\n</mds-modal>\n```\n"
      },
      "props": [
        {
          "name": "max",
          "type": "number",
          "complexType": {
            "original": "number",
            "resolved": "number",
            "references": {}
          },
          "mutable": false,
          "attr": "max",
          "reflectToAttr": true,
          "docs": "The most toasts visible at once: when one more shows, the oldest one with a `duration` is hidden. A toast that stays (`duration=\"0\"`) is never hidden by the region",
          "docsTags": [
            {
              "name": "default",
              "text": "3"
            }
          ],
          "default": "3",
          "values": [
            {
              "type": "number"
            }
          ],
          "optional": false,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "position",
          "type": "\"bottom-center\" | \"bottom-left\" | \"bottom-right\" | \"top-center\" | \"top-left\" | \"top-right\"",
          "complexType": {
            "original": "ToastPosition",
            "resolved": "\"bottom-center\" | \"bottom-left\" | \"bottom-right\" | \"top-center\" | \"top-left\" | \"top-right\"",
            "references": {
              "ToastPosition": {
                "location": "import",
                "path": "@component/mds-toast/meta/types",
                "id": "src/components/mds-toast/meta/types.ts::ToastPosition",
                "referenceLocation": "ToastPosition"
              }
            }
          },
          "mutable": false,
          "attr": "position",
          "reflectToAttr": true,
          "docs": "Sets the edge of the viewport where the toasts line up, and the `position` of every toast inside the region",
          "docsTags": [
            {
              "name": "default",
              "text": "'bottom-center'"
            }
          ],
          "default": "'bottom-center'",
          "values": [
            {
              "value": "bottom-center",
              "type": "string"
            },
            {
              "value": "bottom-left",
              "type": "string"
            },
            {
              "value": "bottom-right",
              "type": "string"
            },
            {
              "value": "top-center",
              "type": "string"
            },
            {
              "value": "top-left",
              "type": "string"
            },
            {
              "value": "top-right",
              "type": "string"
            }
          ],
          "optional": false,
          "required": false,
          "getter": false,
          "setter": false
        }
      ],
      "methods": [],
      "events": [],
      "listeners": [],
      "styles": [
        {
          "name": "--mds-toast-region-gap",
          "annotation": "prop",
          "docs": "Space between the toasts lined up in the region.",
          "visibility": "public"
        }
      ],
      "slots": [
        {
          "name": "",
          "docs": "Add `mds-toast` elements, one per message: the region lines up the visible ones at its edge."
        }
      ],
      "parts": [],
      "states": [],
      "dependents": [],
      "dependencies": [],
      "dependencyGraph": {},
      "storybook": "ui-toast-toast-region--docs"
    }
  ]
}
