{
  "$schema": "https://next.0build.dev/schema/component.v1.json",
  "accessibility": {
    "aria": [],
    "notes": [
      "The tablist gets `role=\"tablist\"` and `aria-orientation`; each trigger gets `role=\"tab\"`, `aria-selected`, `aria-controls`, and a roving `tabindex` (0 on the focused tab, -1 on the rest). Disabled triggers get `aria-disabled`.",
      "Panels get `role=\"tabpanel\"` and `aria-labelledby` pointing at their trigger; inactive panels are `hidden`. Tab item wrappers that have no role get `role=\"presentation\"`."
    ]
  },
  "attributes": [
    {
      "default": null,
      "description": "Index of the active tab, kept in sync with the shown panel. Set `-1` to collapse all when `collapsible` is on; an invalid or disabled index falls back to the first enabled tab.",
      "from": null,
      "name": "active",
      "property": "active",
      "reflect": false,
      "tokens": null,
      "type": "number",
      "values": null
    },
    {
      "default": "''",
      "description": "CSS selector for external panel containers, matched against the whole document. When empty, panels are taken from `.z-switcher` containers inside the host or from a following `.z-switcher` sibling.",
      "from": null,
      "name": "connect",
      "property": "connect",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    },
    {
      "default": "false",
      "description": "Disables panel switching: the tablist still manages active state and keyboard focus, but no panels are shown or hidden.",
      "from": null,
      "name": "no-connect",
      "property": "no-connect",
      "reflect": false,
      "tokens": null,
      "type": "boolean",
      "values": null
    },
    {
      "default": "false",
      "description": "Keyboard navigation moves focus without activating tabs; press Enter or Space to show the focused tab.",
      "from": null,
      "name": "manual",
      "property": "manual",
      "reflect": false,
      "tokens": null,
      "type": "boolean",
      "values": null
    },
    {
      "default": "false",
      "description": "Allows the active tab to be closed by clicking it again (or pressing Enter/Space on it), leaving no panel open and `active` at `-1`.",
      "from": null,
      "name": "collapsible",
      "property": "collapsible",
      "reflect": false,
      "tokens": null,
      "type": "boolean",
      "values": null
    },
    {
      "default": "''",
      "description": "Overrides the tablist orientation used for keyboard navigation and `aria-orientation`. When empty, `.z-tab-left`, `.z-tab-right`, and `.z-nav` (without `.z-subnav`) infer vertical; everything else is horizontal.",
      "from": null,
      "name": "orientation",
      "property": "orientation",
      "reflect": false,
      "tokens": null,
      "type": "'' | 'horizontal' | 'vertical'",
      "values": [
        "",
        "horizontal",
        "vertical"
      ]
    },
    {
      "default": "''",
      "description": "Media query that gates a left/right tablist's vertical side layout: while it matches the side class is kept, and when it stops matching the side class is removed.",
      "from": null,
      "name": "media",
      "property": "media",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    },
    {
      "default": "''",
      "description": "Animation preset applied to a panel as it becomes active. A comma-separated pair uses the first class when moving forward and the second when moving backward.",
      "from": null,
      "name": "animation",
      "property": "animation",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    },
    {
      "default": "150",
      "description": "Panel animation duration in milliseconds; non-finite or negative values fall back to 150.",
      "from": null,
      "name": "duration",
      "property": "duration",
      "reflect": false,
      "tokens": null,
      "type": "number",
      "values": null
    },
    {
      "default": "false",
      "description": "Disables the sliding indicator on `.z-tab` and `.z-tab-alt` tablists, leaving the active tab's static border or background in place.",
      "from": null,
      "name": "no-indicator",
      "property": "no-indicator",
      "reflect": false,
      "tokens": null,
      "type": "boolean",
      "values": null
    },
    {
      "default": "''",
      "description": "Adds classes to named parts as `key: classes` pairs; a plain string targets the default part.",
      "from": "Base",
      "name": "cls",
      "property": "cls",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    },
    {
      "default": "''",
      "description": "Adds inline styles to named parts as `key: styles` pairs; a plain string targets the default part.",
      "from": "Base",
      "name": "stl",
      "property": "stl",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    }
  ],
  "category": "navigation",
  "children": [],
  "cssClasses": [
    {
      "appliesTo": ".z-switcher",
      "class": ".z-active",
      "description": "State class marking the active tab item, its trigger, and the active panel.",
      "role": "state"
    },
    {
      "appliesTo": "z-switcher",
      "class": ".z-switcher",
      "description": "Panel container: its direct children are the panels, and every child without `.z-active` is hidden.",
      "role": "root"
    }
  ],
  "cssVars": [],
  "dataHooks": [
    {
      "appliesTo": "descendant",
      "attribute": "data-fn",
      "description": "Marks a deferred `<template>` child whose content is mounted into the container on demand.",
      "from": "Controller",
      "role": "config",
      "values": [
        "template"
      ]
    },
    {
      "appliesTo": "descendant",
      "attribute": "data-open",
      "description": "Triggers carrying `data-open` are skipped during tab detection; the attribute belongs to the dialog toggle system, not the switcher.",
      "role": "config",
      "values": []
    },
    {
      "appliesTo": "descendant",
      "attribute": "data-switcher-ignore",
      "description": "Excludes a tablist child from tab detection; `.z-nav-header` and `.z-nav-divider` children are ignored automatically.",
      "role": "config",
      "values": []
    },
    {
      "appliesTo": "descendant",
      "attribute": "data-switcher-item",
      "description": "Turns a descendant element into a remote control: clicking it shows the tab whose index, value, or href matches the attribute, or steps through enabled tabs with `next`/`previous`.",
      "role": "trigger",
      "values": [
        "next",
        "previous"
      ]
    },
    {
      "appliesTo": "descendant",
      "attribute": "data-toggle",
      "description": "Triggers carrying `data-toggle` are skipped during tab detection; the attribute belongs to the dialog toggle system, not the switcher.",
      "role": "config",
      "values": []
    },
    {
      "appliesTo": "descendant",
      "attribute": "data-value",
      "description": "Identifies a tab for `show()` and `active` targeting; read from the trigger or its item, falling back to the trigger href or the tab index.",
      "role": "read-only",
      "values": []
    }
  ],
  "events": [
    {
      "bubbles": true,
      "cancelable": true,
      "description": "Fires before the active tab changes; `preventDefault()` cancels the switch. Detail carries the target `index`, `previousIndex`, `item`, `trigger`, and `value`.",
      "detail": {
        "fields": [
          {
            "name": "index",
            "type": "number"
          },
          {
            "name": "previousIndex",
            "type": "number"
          },
          {
            "name": "item",
            "type": "HTMLElement | null"
          },
          {
            "name": "trigger",
            "type": "HTMLElement | null"
          },
          {
            "name": "value",
            "type": "string | null"
          }
        ],
        "type": "{ index: number; previousIndex: number; item: HTMLElement | null; trigger: HTMLElement | null; value: string | null }"
      },
      "name": "z-switcher:before-change"
    },
    {
      "bubbles": true,
      "cancelable": false,
      "description": "Fires after the active tab changes, with the same detail as `before-change`.",
      "detail": {
        "fields": [
          {
            "name": "index",
            "type": "number"
          },
          {
            "name": "previousIndex",
            "type": "number"
          },
          {
            "name": "item",
            "type": "HTMLElement | null"
          },
          {
            "name": "trigger",
            "type": "HTMLElement | null"
          },
          {
            "name": "value",
            "type": "string | null"
          }
        ],
        "type": "{ index: number; previousIndex: number; item: HTMLElement | null; trigger: HTMLElement | null; value: string | null }"
      },
      "name": "z-switcher:change"
    },
    {
      "bubbles": true,
      "cancelable": false,
      "description": "Fires when deferred template content is mounted into the container.",
      "detail": {
        "fields": [],
        "type": "Record<string, unknown>"
      },
      "from": "Controller",
      "name": "z-switcher:mount"
    }
  ],
  "i18n": [],
  "icons": [],
  "id": "switcher",
  "inherits": [
    "Controller",
    "Base"
  ],
  "keyboard": [
    {
      "action": "Move focus to the next / previous enabled tab, wrapping at the ends; reversed in RTL. Also activates the tab unless `manual` is set.",
      "keys": [
        "ArrowRight",
        "ArrowLeft"
      ],
      "when": "Focus is on a tab in a horizontal tablist"
    },
    {
      "action": "Move focus to the next / previous enabled tab, wrapping at the ends. Also activates the tab unless `manual` is set.",
      "keys": [
        "ArrowDown",
        "ArrowUp"
      ],
      "when": "Focus is on a tab in a vertical tablist"
    },
    {
      "action": "Move focus to the first / last enabled tab.",
      "keys": [
        "Home",
        "End"
      ],
      "when": "Focus is on a tab"
    },
    {
      "action": "Show the focused tab, or collapse it when it is already active and `collapsible` is set.",
      "keys": [
        "Enter",
        " "
      ],
      "when": "Focus is on a tab"
    }
  ],
  "kind": "controller",
  "methods": [
    {
      "description": "Returns the index of the active tab, or `-1` when all tabs are collapsed.",
      "name": "index",
      "params": [],
      "returns": "number",
      "static": false
    },
    {
      "description": "Re-scans the tablist and panels, rebinds listeners, and re-measures the indicator after the DOM changes.",
      "name": "refresh",
      "params": [],
      "returns": "void",
      "static": false
    },
    {
      "description": "Shows a tab by index, by `next`/`previous` (wrapping over enabled tabs), or by a value/href string; returns `true` when the tab is shown. A negative index collapses all when `collapsible` is on.",
      "name": "show",
      "params": [
        {
          "default": null,
          "name": "target",
          "optional": false,
          "type": "number | 'next' | 'previous' | string"
        }
      ],
      "returns": "boolean",
      "static": false
    }
  ],
  "notes": [
    "The tablist is resolved from `[data-part=\"tablist\"]` or `[role=\"tablist\"]`, then `.z-tab`, `.z-tab-alt`, `.z-subnav`, or `.z-nav`, then the first layout child. Tabs are its direct children that are links, buttons, or `role=\"tab\"` elements, or whose first direct child is one.",
    "The sliding indicator is driven by the `--z-tab-indicator-*` variables on `.z-tab` and `.z-tab-alt` tablists (see the Tab component) and re-measures on resize.",
    "Clicking a tab whose href is a real URL navigates normally when no panel containers are connected; hash links and connected panels always switch in place."
  ],
  "parts": {
    "defaultClsTarget": "active",
    "defaultStlTarget": "host-inner",
    "items": [
      {
        "defaultCls": "z-active",
        "description": "Class applied to the active tab item, its trigger, and the active panel; the default `cls` target for this component.",
        "foundIn": [
          "$cls"
        ],
        "key": "active",
        "supportsCls": true,
        "supportsStl": false
      }
    ]
  },
  "recipes": [],
  "related": [
    "tab"
  ],
  "schemaVersion": 1,
  "sources": {
    "css": [
      "src/css/kit-components/switcher.css",
      "src/css/kit-components/tab.css"
    ],
    "cssSelectors": [
      ".z-switcher",
      ".z-switcher-*"
    ],
    "ts": "src/js/controllers/components/switcher.ts"
  },
  "summary": "Tabbed content switcher with a sliding indicator, keyboard navigation, collapsible and manual modes, and animated panel transitions.",
  "tag": "z-switcher",
  "title": "Switcher"
}
