{
  "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/mds-tab-bar.tsx",
      "encapsulation": "shadow",
      "tag": "mds-tab-bar",
      "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 `mds-tab-bar-item` element/s."
        },
        {
          "name": "category",
          "text": "navigation"
        }
      ],
      "usage": {
        "1. Description": "The `<mds-tab-bar>` web component is the compound container of the Magma Design System that groups a set of `<mds-tab-bar-item>` children into a single selectable navigation bar, owning the mutual-exclusion logic that keeps exactly one item active at a time. The bar is fixed to the bottom edge of the viewport (`position: fixed`), full width.\n\n#### Semantic Behavior\n\n- **Compound parent/child**: It accepts only `<mds-tab-bar-item>` elements in its default slot and acts purely as their coordinator.\n- **Single active selection**: When one item reports selection, the others are deselected - enforcing one-active-at-a-time behavior.\n- **Change notification**: After resolving the new selection it emits `mdsTabBarChange` whose detail carries the zero-based `index` of the newly selected item, intended to drive panel/view switching by the consumer.\n- **Default-slot semantics**: The slot is structural (it expects components, not text); the textual label lives inside each `<mds-tab-bar-item>` instead.\n\n#### Properties & Visual Configurations\n\n`<mds-tab-bar>` itself exposes no configuration props - its appearance and content are entirely determined by the `<mds-tab-bar-item>` children it wraps. The relevant intent lives on those children:\n\n- **`selected`** marks which item is active. The parent rewrites it during selection changes; set it on a single child to define the initial active tab.\n- **`icon`** is an SVG filename slug from the Magma icon library, rendered above the item's text label.\n- **`typography`** selects the text scale of the item label from the smaller-typography ladder (defaulting to `'tip'`), letting authors match tab density to surrounding chrome.\n\nThis component does not use the shared `variant` / `tone` ladders defined in [`agents/variants.md`](../../../../agents/variants.md).\n",
        "2. Examples": "Correct and idiomatic ways to use the `<mds-tab-bar>` 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 Navigation Bar\n\nThe canonical form. Place one `<mds-tab-bar-item>` per destination. Provide `icon` as a slug from the Magma icon library and the text via the `label` prop. Mark the initially active item with `selected`.\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-item icon=\"mi/baseline/person\" label=\"Profilo\"></mds-tab-bar-item>\n</mds-tab-bar>\n```\n\n#### Reacting to Tab Changes\n\nListen for `mdsTabBarChange` on the host. The event detail carries `index` - the zero-based position of the newly selected item - which you use to switch the visible view or panel.\n\n```html\n<mds-tab-bar id=\"app-nav\">\n  <mds-tab-bar-item icon=\"mi/baseline/home\" label=\"Home\" selected></mds-tab-bar-item>\n  <mds-tab-bar-item icon=\"mi/baseline/inbox\" label=\"Messaggi\"></mds-tab-bar-item>\n  <mds-tab-bar-item icon=\"mi/baseline/settings\" label=\"Impostazioni\"></mds-tab-bar-item>\n</mds-tab-bar>\n\n<script>\n  document.querySelector('#app-nav').addEventListener('mdsTabBarChange', (e) => {\n    const activeIndex = e.detail.index;\n    showView(activeIndex);\n  });\n</script>\n```\n\n#### Setting the Initial Active Tab Programmatically\n\nSet `selected` on exactly one child to control the starting state. If you later need to change the active item from outside - for example, after a router navigation - set `selected` on the new item and remove it from the previous one yourself: the parent syncs the siblings only when an item is clicked, and emits no `mdsTabBarChange` for a change made from code.\n\n```html\n<!-- Second item active on load -->\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/explore\" label=\"Scopri\" selected></mds-tab-bar-item>\n  <mds-tab-bar-item icon=\"mi/baseline/favorite\" label=\"Preferiti\"></mds-tab-bar-item>\n</mds-tab-bar>\n```\n\n#### Adjusting Label Typography\n\nUse `typography` on individual items to match the text density to the surrounding chrome. The prop accepts `\"tip\"` (default, smaller) or `\"option\"` (slightly larger). You can mix values if items carry different visual weight.\n\n```html\n<mds-tab-bar>\n  <mds-tab-bar-item icon=\"mi/baseline/home\" label=\"Home\" typography=\"option\" selected></mds-tab-bar-item>\n  <mds-tab-bar-item icon=\"mi/baseline/inbox\" label=\"Posta\" typography=\"option\"></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 via CSS Custom Properties\n\nStyle individual items through the 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 specific item or on a parent selector. Use semantic color roles via `rgb(var(--magma-<role>))` so dark mode and high-contrast keep working.\n\n```css\n/* A resting background for the whole bar */\nmds-tab-bar mds-tab-bar-item {\n  --mds-tab-bar-item-background: rgb(var(--magma-wash-base));\n}\n\n/* A single item with a distinct idle color */\nmds-tab-bar-item.priority {\n  --mds-tab-bar-item-color: rgb(var(--magma-warning-text-default));\n}\n```\n",
        "3. Mistakes": "Common incorrect uses of `<mds-tab-bar>`. 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 Place HTML Elements or Text Directly in the Bar's Default Slot\n\n`<mds-tab-bar>` only coordinates `<mds-tab-bar-item>` children; arbitrary HTML or text in its slot breaks the mutual-exclusion logic and the change event.\n\n```html\n<!-- INCORRECT -->\n<mds-tab-bar>\n  <button>Home</button>\n  <a href=\"/cerca\">Cerca</a>\n</mds-tab-bar>\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 an Item's Text\n\nSetting an item's text via the default slot is deprecated. Slotted text is read into `label`, and nested HTML is stripped with a console warning - use the `label` prop for the text and the `icon` prop for the glyph.\n\n```html\n<!-- INCORRECT -->\n<mds-tab-bar-item icon=\"mi/baseline/inbox\">Messaggi</mds-tab-bar-item>\n<mds-tab-bar-item>\n  <span class=\"bold\">Messaggi</span>\n  <small>(3)</small>\n</mds-tab-bar-item>\n\n<!-- CORRECT -->\n<mds-tab-bar-item icon=\"mi/baseline/inbox\" label=\"Messaggi\"></mds-tab-bar-item>\n```\n\n#### Do Not Slot `<mds-icon>` to Add an Icon\n\nThe item's `icon` prop renders the glyph through the shared icon service and positions it correctly above the label. Slotting `<mds-icon>` puts it in the deprecated default slot, where it is misaligned or stripped.\n\n```html\n<!-- INCORRECT -->\n<mds-tab-bar-item>\n  <mds-icon name=\"mi/baseline/home\"></mds-icon>\n  Home\n</mds-tab-bar-item>\n\n<!-- CORRECT -->\n<mds-tab-bar-item icon=\"mi/baseline/home\" label=\"Home\"></mds-tab-bar-item>\n```\n\n#### Do Not Set `selected=\"false\"` to Deselect an Item\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 entirely to deselect an item, or let the parent coordinate selection automatically.\n\n```html\n<!-- INCORRECT -->\n<mds-tab-bar-item icon=\"mi/baseline/home\" label=\"Home\" selected=\"false\"></mds-tab-bar-item>\n\n<!-- CORRECT -->\n<mds-tab-bar-item icon=\"mi/baseline/home\" label=\"Home\"></mds-tab-bar-item>\n```\n\n#### Do Not Listen for the Item's Internal Event on the Bar's Children\n\n`mdsTabBarItemSelect` is the item-level event `<mds-tab-bar>` coordinates on: its `detail` is the item's `id`, the one you gave it or the `mds-tab-bar-item-<index>` the bar gives an item without one. To react to selection changes from outside, listen for `mdsTabBarChange` on the parent instead, whose `detail.index` is the position of the selected item.\n\n```html\n<!-- INCORRECT -->\n<script>\n  document.querySelector('mds-tab-bar-item').addEventListener('mdsTabBarItemSelect', handler);\n</script>\n\n<!-- CORRECT -->\n<script>\n  document.querySelector('mds-tab-bar').addEventListener('mdsTabBarChange', (e) => {\n    handler(e.detail.index);\n  });\n</script>\n```\n\n#### Do Not Style Items by Piercing Shadow DOM\n\nThe only supported customization surface is the two public `--mds-tab-bar-item-*` CSS custom properties, `--mds-tab-bar-item-background` and `--mds-tab-bar-item-color` (the icon follows the text colour). Targeting internal nodes via `::part()`, `>>>`, or undocumented class names couples your code to the Shadow DOM implementation and will break on minor releases.\n\n```css\n/* INCORRECT */\nmds-tab-bar-item >>> mds-icon {\n  fill: hotpink;\n}\n\n/* CORRECT */\nmds-tab-bar mds-tab-bar-item {\n  --mds-tab-bar-item-color: rgb(var(--magma-text-muted));\n}\n```\n"
      },
      "props": [],
      "methods": [],
      "events": [
        {
          "event": "mdsTabBarChange",
          "detail": "MdsTabBarEventDetail",
          "bubbles": true,
          "complexType": {
            "original": "MdsTabBarEventDetail",
            "resolved": "MdsTabBarEventDetail",
            "references": {
              "MdsTabBarEventDetail": {
                "location": "import",
                "path": "./meta/event-detail",
                "id": "src/components/mds-tab-bar/meta/event-detail.ts::MdsTabBarEventDetail",
                "referenceLocation": "MdsTabBarEventDetail"
              }
            }
          },
          "cancelable": true,
          "composed": true,
          "docs": "Emits when a step is changed",
          "docsTags": []
        }
      ],
      "listeners": [
        {
          "event": "mdsTabBarItemSelect",
          "capture": false,
          "passive": false
        }
      ],
      "styles": [],
      "slots": [
        {
          "name": "",
          "docs": "Add `mds-tab-bar-item` element/s."
        }
      ],
      "parts": [],
      "states": [],
      "dependents": [],
      "dependencies": [],
      "dependencyGraph": {},
      "storybook": "ui-tab-bar--docs"
    }
  ]
}
