{
  "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-tab-bar-item/mds-tab-bar-item.tsx",
      "encapsulation": "shadow",
      "tag": "mds-tab-bar-item",
      "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": "parent",
          "text": "mds-tab-bar"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-tab-bar-item>` web component is a single selectable tab within the [`<mds-tab-bar>`](../mds-tab-bar/AGENTS.md) container. It renders an icon stacked over a text label and acts as one option in the bar's mutually-exclusive selection group.\n\n#### Semantic Behavior\n\n- **Compound child only**: Must be placed as a direct default-slot child of `<mds-tab-bar>`; it is not used standalone or mixed with other child types.\n- **Parent-coordinated selection**: Clicking an item that is not selected selects it and emits `mdsTabBarItemSelect` carrying its own `id`; a click on the selected item changes nothing and emits nothing. The parent re-drives every sibling's `selected` so exactly one item is active at a time - items do not deselect each other on their own.\n- **Whole-host click target**: The entire item (icon + label) is the click surface, not just the text. It is a button (`role=\"button\"`, unless you set another role) in the tab order, activated by Enter and Space as by a click; the selected item carries `aria-current=\"true\"`.\n- **Label is text**: Set the visible text with the `label` prop. The default slot is a **deprecated** fallback kept for backward compatibility - slotted text is read into `label`, while nested HTML is stripped with a console warning; avoid placing HTML elements or other components there.\n\n#### Properties & Visual Configurations\n\n- **`icon`**: Icon name shown above the label; use it to give the tab a recognizable glyph. Optional - defaults to empty.\n- **`label`**: The tab's visible text. This is the preferred and idiomatic way to set the text, matching the `label` prop on [`mds-button`](../mds-button/AGENTS.md) and other Magma components.\n- **`selected`**: Marks this item as the active tab. You typically do not toggle it manually at runtime - the parent manages it - but you can set it on one item as the initial active tab.\n- **`typography`**: Controls the label's text style, constrained to the smaller typography set (`tip` by default, or `option`). Pick `option` for a slightly more prominent label.\n\nThe resting appearance is configured through the public `--mds-tab-bar-item-background` and `--mds-tab-bar-item-color` CSS custom properties listed in [`AGENTS.md`](AGENTS.md); the selected item keeps its own accent colouring.\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-tab-bar-item>` 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#### Basic Tab Bar\n\nThe canonical form. Place all items directly inside `<mds-tab-bar>`. Give each item an `icon` and set its text with the `label` prop. The parent keeps the `id` you give an item, gives one to the items without, and coordinates selection.\n\n```html\n<mds-tab-bar>\n  <mds-tab-bar-item icon=\"mi/baseline/home\" label=\"Home\"></mds-tab-bar-item>\n  <mds-tab-bar-item icon=\"mi/baseline/search\" label=\"Cerca\"></mds-tab-bar-item>\n  <mds-tab-bar-item icon=\"mi/baseline/notifications\" label=\"Notifiche\"></mds-tab-bar-item>\n  <mds-tab-bar-item icon=\"mi/baseline/person\" label=\"Profilo\"></mds-tab-bar-item>\n</mds-tab-bar>\n```\n\n#### Setting the Initial Active Tab\n\nMark one item as pre-selected on first render with the `selected` boolean attribute. Do not set more than one item as `selected` - the parent enforces mutual exclusivity once the first click event fires.\n\n```html\n<mds-tab-bar>\n  <mds-tab-bar-item icon=\"mi/baseline/home\" label=\"Home\" selected></mds-tab-bar-item>\n  <mds-tab-bar-item icon=\"mi/baseline/search\" label=\"Cerca\"></mds-tab-bar-item>\n  <mds-tab-bar-item icon=\"mi/baseline/notifications\" label=\"Notifiche\"></mds-tab-bar-item>\n</mds-tab-bar>\n```\n\n#### Listening for Selection Changes\n\nListen to `mdsTabBarItemSelect` on the item to react when a specific tab becomes active, or listen to `mdsTabBarChange` on the parent to receive the zero-based index of the newly selected item.\n\n```html\n<mds-tab-bar id=\"main-nav\">\n  <mds-tab-bar-item icon=\"mi/baseline/home\" label=\"Home\"></mds-tab-bar-item>\n  <mds-tab-bar-item icon=\"mi/baseline/search\" label=\"Cerca\"></mds-tab-bar-item>\n  <mds-tab-bar-item icon=\"mi/baseline/person\" label=\"Profilo\"></mds-tab-bar-item>\n</mds-tab-bar>\n\n<script>\n  document.querySelector('#main-nav').addEventListener('mdsTabBarChange', (e) => {\n    console.log('tab selezionato:', e.detail.index);\n  });\n</script>\n```\n\n#### Driving Selection Programmatically\n\nSet the `selected` prop on the desired item from JavaScript, and remove it from the previously selected one: the item updates its own visual state, but the parent syncs the siblings only on the next click and emits no `mdsTabBarChange` for a change made from code. Do not address the items by your own `id`: the bar replaces it with `mds-tab-bar-item-<index>` when it loads.\n\n```html\n<mds-tab-bar id=\"wizard-nav\">\n  <mds-tab-bar-item icon=\"mi/baseline/person\" label=\"Profilo\"></mds-tab-bar-item>\n  <mds-tab-bar-item icon=\"mi/baseline/lock\" label=\"Sicurezza\"></mds-tab-bar-item>\n  <mds-tab-bar-item\n    icon=\"mi/baseline/notifications\"\n    label=\"Notifiche\"\n  ></mds-tab-bar-item>\n</mds-tab-bar>\n\n<script>\n  document.querySelectorAll('#wizard-nav mds-tab-bar-item')[1].selected = true;\n</script>\n```\n\n#### Larger Label Typography\n\nUse `typography=\"option\"` for a slightly more prominent label when the tab bar sits in a layout where `tip` (the default) reads too small.\n\n```html\n<mds-tab-bar>\n  <mds-tab-bar-item\n    icon=\"mi/baseline/dashboard\"\n    label=\"Dashboard\"\n    typography=\"option\"\n    selected\n  ></mds-tab-bar-item>\n  <mds-tab-bar-item\n    icon=\"mi/baseline/bar-chart\"\n    label=\"Statistiche\"\n    typography=\"option\"\n  ></mds-tab-bar-item>\n  <mds-tab-bar-item\n    icon=\"mi/baseline/settings\"\n    label=\"Impostazioni\"\n    typography=\"option\"\n  ></mds-tab-bar-item>\n</mds-tab-bar>\n```\n\n#### Styling Customization\n\nOverride colors through the two public `--mds-tab-bar-item-*` CSS custom properties, the background and the text colour of the item at rest (the selected item keeps its accent colouring). Set them on the host or a parent selector; use semantic color roles via `rgb(var(--magma-<role>))` so dark mode keeps working.\n\n```css\n.app-bottom-nav mds-tab-bar-item {\n  --mds-tab-bar-item-background: rgb(var(--magma-wash-base));\n  --mds-tab-bar-item-color: rgb(var(--magma-text-muted));\n}\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-tab-bar-item>`. 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 Outside `<mds-tab-bar>`\n\n`<mds-tab-bar-item>` relies on the parent to give it an `id` when it has none, listen for `mdsTabBarItemSelect`, and drive mutual exclusivity. Without the parent, an item without an `id` reports an empty one, selection does not propagate, and no other item is deselected when this one is clicked.\n\n```html\n<!-- INCORRECT -->\n<mds-tab-bar-item icon=\"mi/baseline/home\" label=\"Home\" selected></mds-tab-bar-item>\n\n<!-- CORRECT -->\n<mds-tab-bar>\n  <mds-tab-bar-item icon=\"mi/baseline/home\" label=\"Home\" selected></mds-tab-bar-item>\n  <mds-tab-bar-item icon=\"mi/baseline/search\" label=\"Cerca\"></mds-tab-bar-item>\n</mds-tab-bar>\n```\n\n#### Do Not Use the Deprecated Default Slot for Text\n\nSetting the text via the default slot is deprecated. Slotted text is read into `label`, and any nested HTML is stripped with a console warning. Use the `label` prop instead.\n\n```html\n<!-- INCORRECT -->\n<mds-tab-bar>\n  <mds-tab-bar-item icon=\"mi/baseline/home\">Home</mds-tab-bar-item>\n  <mds-tab-bar-item icon=\"mi/baseline/search\"><strong>Cerca</strong></mds-tab-bar-item>\n</mds-tab-bar>\n\n<!-- CORRECT -->\n<mds-tab-bar>\n  <mds-tab-bar-item icon=\"mi/baseline/home\" label=\"Home\"></mds-tab-bar-item>\n  <mds-tab-bar-item icon=\"mi/baseline/search\" label=\"Cerca\"></mds-tab-bar-item>\n</mds-tab-bar>\n```\n\n#### Do Not Slot `<mds-icon>` to Add an Icon\n\nThe `icon` prop renders the glyph through the shared icon service and positions it above the label automatically. Slotting `<mds-icon>` puts it in the deprecated default slot, where it is stripped and misaligns.\n\n```html\n<!-- INCORRECT -->\n<mds-tab-bar>\n  <mds-tab-bar-item>\n    <mds-icon name=\"mi/baseline/home\"></mds-icon>\n    Home\n  </mds-tab-bar-item>\n</mds-tab-bar>\n\n<!-- CORRECT -->\n<mds-tab-bar>\n  <mds-tab-bar-item icon=\"mi/baseline/home\" label=\"Home\"></mds-tab-bar-item>\n</mds-tab-bar>\n```\n\n#### Do Not Set `selected=\"false\"` to Deselect\n\n`selected` is a boolean attribute. The item happens to style `selected=\"false\"` as unselected, but the attribute stays on the element and contradicts the state for attribute selectors and checks. Remove the attribute or set the property to `undefined` to deselect.\n\n```html\n<!-- INCORRECT -->\n<mds-tab-bar>\n  <mds-tab-bar-item icon=\"mi/baseline/home\" label=\"Home\" selected=\"false\"></mds-tab-bar-item>\n</mds-tab-bar>\n\n<!-- CORRECT -->\n<mds-tab-bar>\n  <mds-tab-bar-item icon=\"mi/baseline/home\" label=\"Home\"></mds-tab-bar-item>\n</mds-tab-bar>\n```\n\n#### Do Not Listen to Raw Click Events for Tab Changes\n\n`<mds-tab-bar-item>` emits `mdsTabBarItemSelect` when selected; `<mds-tab-bar>` re-emits `mdsTabBarChange` with the resolved index. Listening to the native `click` event gives you no index, and it also fires on clicks that select nothing (any click on the item that is already active).\n\n```html\n<!-- INCORRECT -->\n<mds-tab-bar id=\"nav\">\n  <mds-tab-bar-item icon=\"mi/baseline/home\" label=\"Home\"></mds-tab-bar-item>\n</mds-tab-bar>\n<script>\n  document.querySelector('mds-tab-bar-item').addEventListener('click', handler);\n</script>\n\n<!-- CORRECT -->\n<mds-tab-bar id=\"nav\">\n  <mds-tab-bar-item icon=\"mi/baseline/home\" label=\"Home\"></mds-tab-bar-item>\n</mds-tab-bar>\n<script>\n  document.querySelector('#nav').addEventListener('mdsTabBarChange', handler);\n</script>\n```\n\n#### Do Not Use an Invalid `typography` Value\n\n`typography` accepts only `\"tip\"` (default) or `\"option\"`. Passing any other value - such as `\"caption\"` or `\"label\"` - is outside the typed `TypographySmallerType`: it is passed unchecked to the inner `<mds-text>`, so the label silently leaves the tab bar's type scale.\n\n```html\n<!-- INCORRECT -->\n<mds-tab-bar>\n  <mds-tab-bar-item icon=\"mi/baseline/home\" label=\"Home\" typography=\"caption\"></mds-tab-bar-item>\n</mds-tab-bar>\n\n<!-- CORRECT -->\n<mds-tab-bar>\n  <mds-tab-bar-item icon=\"mi/baseline/home\" label=\"Home\" typography=\"option\"></mds-tab-bar-item>\n</mds-tab-bar>\n```\n"
      },
      "props": [
        {
          "name": "icon",
          "type": "string",
          "complexType": {
            "original": "string",
            "resolved": "string",
            "references": {}
          },
          "mutable": false,
          "attr": "icon",
          "reflectToAttr": false,
          "docs": "The icon displayed in the tab bar item.",
          "docsTags": [
            {
              "name": "default",
              "text": "''"
            }
          ],
          "default": "''",
          "values": [
            {
              "type": "string"
            }
          ],
          "optional": false,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "label",
          "type": "string | undefined",
          "complexType": {
            "original": "string",
            "resolved": "string | undefined",
            "references": {}
          },
          "mutable": true,
          "attr": "label",
          "reflectToAttr": true,
          "docs": "Sets the label of the tab bar item",
          "docsTags": [],
          "values": [
            {
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "selected",
          "type": "boolean",
          "complexType": {
            "original": "boolean",
            "resolved": "boolean",
            "references": {}
          },
          "mutable": true,
          "attr": "selected",
          "reflectToAttr": true,
          "docs": "Specifies if the component is selected or not",
          "docsTags": [],
          "values": [
            {
              "type": "boolean"
            }
          ],
          "optional": false,
          "required": false,
          "getter": false,
          "setter": false
        },
        {
          "name": "typography",
          "type": "\"option\" | \"tip\" | undefined",
          "complexType": {
            "original": "TypographySmallerType",
            "resolved": "\"option\" | \"tip\" | undefined",
            "references": {
              "TypographySmallerType": {
                "location": "import",
                "path": "@type/typography",
                "id": "src/type/typography.ts::TypographySmallerType",
                "referenceLocation": "TypographySmallerType"
              }
            }
          },
          "mutable": false,
          "attr": "typography",
          "reflectToAttr": false,
          "docs": "Specifies the typography of the element",
          "docsTags": [
            {
              "name": "default",
              "text": "'tip'"
            }
          ],
          "default": "'tip'",
          "values": [
            {
              "value": "option",
              "type": "string"
            },
            {
              "value": "tip",
              "type": "string"
            },
            {
              "type": "undefined"
            }
          ],
          "optional": true,
          "required": false,
          "getter": false,
          "setter": false
        }
      ],
      "methods": [],
      "events": [
        {
          "event": "mdsTabBarItemSelect",
          "detail": "string",
          "bubbles": true,
          "complexType": {
            "original": "string",
            "resolved": "string",
            "references": {}
          },
          "cancelable": true,
          "composed": true,
          "docs": "Emits when the component is selected",
          "docsTags": []
        }
      ],
      "listeners": [],
      "styles": [
        {
          "name": "--mds-tab-bar-item-background",
          "annotation": "prop",
          "docs": "Sets the background-color of the component",
          "visibility": "public"
        },
        {
          "name": "--mds-tab-bar-item-background-selected",
          "annotation": "prop",
          "docs": "Sets the background-color of the component when it's selected",
          "visibility": "internal"
        },
        {
          "name": "--mds-tab-bar-item-color",
          "annotation": "prop",
          "docs": "Sets the text color of the component",
          "visibility": "public"
        },
        {
          "name": "--mds-tab-bar-item-color-selected",
          "annotation": "prop",
          "docs": "Sets the text color of the component when it's selected",
          "visibility": "internal"
        }
      ],
      "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": [],
      "dependencies": [
        "mds-icon",
        "mds-text"
      ],
      "dependencyGraph": {
        "mds-tab-bar-item": [
          "mds-icon",
          "mds-text"
        ]
      },
      "storybook": "ui-tab-bar-tab-bar-item--docs"
    }
  ]
}
