{
  "$schema": "https://next.0build.dev/schema/component.v1.json",
  "accessibility": {
    "aria": [
      {
        "attributes": [
          {
            "name": "aria-label",
            "value": "${this.getAriaLabel()}"
          },
          {
            "name": "aria-pressed",
            "value": "${this.isActive}"
          }
        ],
        "description": "Toggle button with a composed `aria-label` (base label, value, active suffix — or the switch-to label in toggle mode) and `aria-pressed` reflecting the active state.",
        "part": "button"
      }
    ],
    "notes": [
      "The button is a real `button` with `aria-pressed`; the label announces the current action in toggle mode."
    ]
  },
  "attributes": [
    {
      "default": "''",
      "description": "Value applied to the group when clicked (e.g. `dark`, `light`, or a theme class like `theme-ocean`).",
      "from": null,
      "name": "value",
      "property": "value",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    },
    {
      "default": "''",
      "description": "Configuration group the value belongs to; `mode` is special-cased to toggle the `dark` class on `<html>`.",
      "from": null,
      "name": "group",
      "property": "group",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    },
    {
      "default": "false",
      "description": "Opts out of listening to other instances' `z-lsh:change` events.",
      "from": null,
      "name": "prevent-autoupdate",
      "property": "prevent-autoupdate",
      "reflect": false,
      "tokens": null,
      "type": "boolean",
      "values": null
    },
    {
      "default": "false",
      "description": "In the `mode` group, flips between dark and light instead of applying a fixed value.",
      "from": null,
      "name": "toggle",
      "property": "toggle",
      "reflect": false,
      "tokens": null,
      "type": "boolean",
      "values": null
    },
    {
      "default": "''",
      "description": "Per-instance text overrides as `key: text` pairs, merged over the global `z-i18n` script and the built-in defaults.",
      "from": "Hwc",
      "name": "i18n",
      "property": "i18n",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    },
    {
      "default": "''",
      "description": "Floating UI placement options (for example `offset` and `shiftPadding`) parsed as `key: value` pairs.",
      "from": "Hwc",
      "name": "floating",
      "property": "floating",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    },
    {
      "default": "false",
      "description": "Skips re-rendering after the first render; an existing `data-host-inner` child is adopted as the rendered DOM.",
      "from": "Hwc",
      "name": "force-prevent-rerender",
      "property": "force-prevent-rerender",
      "reflect": false,
      "tokens": null,
      "type": "boolean",
      "values": null
    },
    {
      "default": "''",
      "description": "Selector or id of an external element or `<template>` whose inner content is cloned in place of an inline `template[data-fn=\"template\"]` child.",
      "from": "Hwc",
      "name": "template",
      "property": "template",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "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": [
    {
      "attributes": [
        {
          "description": "Marks the script as configuration (value: `config`).",
          "name": "data-fn",
          "required": true,
          "values": [
            "config"
          ]
        },
        {
          "description": "Re-parses the configuration when the script mutates.",
          "name": "data-reactive",
          "required": false,
          "type": "boolean"
        }
      ],
      "description": "JSON configuration script parsed by the base class (i18n, cls, stl, floating).",
      "element": "script",
      "id": "config",
      "required": false,
      "selector": "script[data-fn=\"config\"][type=\"application/json\"]"
    },
    {
      "attributes": [
        {
          "description": "Marks the select as the data source (value: `data-source`).",
          "name": "data-fn",
          "required": true,
          "values": [
            "data-source"
          ]
        },
        {
          "description": "Re-parses the options when the select mutates.",
          "name": "data-reactive",
          "required": false,
          "type": "boolean"
        }
      ],
      "children": [
        {
          "attributes": [
            {
              "description": "Group header text; also the default group key.",
              "name": "label",
              "required": true,
              "type": "string"
            },
            {
              "description": "Disables every option in the group.",
              "name": "disabled",
              "required": false,
              "type": "boolean"
            },
            {
              "description": "Overrides the group key used in the parsed data.",
              "name": "data-key",
              "required": false,
              "type": "string"
            },
            {
              "description": "Comma-separated keywords stored with the group's data.",
              "name": "data-keywords",
              "required": false,
              "type": "comma-separated string"
            }
          ],
          "children": [
            {
              "attributes": [
                {
                  "description": "Value carried by this option in the parsed data.",
                  "name": "value",
                  "required": false,
                  "type": "string"
                },
                {
                  "description": "Makes the option non-selectable.",
                  "name": "disabled",
                  "required": false,
                  "type": "boolean"
                },
                {
                  "description": "Marks the option as initially selected.",
                  "name": "selected",
                  "required": false,
                  "type": "boolean"
                },
                {
                  "description": "Extra search terms, comma-separated; searched alongside the label and value.",
                  "name": "data-keywords",
                  "required": false,
                  "type": "comma-separated string"
                }
              ],
              "description": "One option entry within the group.",
              "element": "option",
              "repeatable": true
            }
          ],
          "description": "Groups options under a label.",
          "element": "optgroup",
          "repeatable": true
        },
        {
          "attributes": [
            {
              "description": "Value carried by this option in the parsed data.",
              "name": "value",
              "required": false,
              "type": "string"
            },
            {
              "description": "Makes the option non-selectable.",
              "name": "disabled",
              "required": false,
              "type": "boolean"
            },
            {
              "description": "Marks the option as initially selected.",
              "name": "selected",
              "required": false,
              "type": "boolean"
            },
            {
              "description": "Extra search terms, comma-separated.",
              "name": "data-keywords",
              "required": false,
              "type": "comma-separated string"
            }
          ],
          "description": "One ungrouped option entry.",
          "element": "option",
          "repeatable": true
        }
      ],
      "description": "Hidden select parsed into grouped option data by the base class.",
      "element": "select",
      "id": "data-source",
      "required": false,
      "selector": "select[data-fn=\"data-source\"]"
    },
    {
      "attributes": [
        {
          "description": "Marks the template as an icon source (value: `icons`).",
          "name": "data-fn",
          "required": true,
          "values": [
            "icons"
          ]
        },
        {
          "description": "Re-parses the icons when the template mutates.",
          "name": "data-reactive",
          "required": false,
          "type": "boolean"
        }
      ],
      "children": [
        {
          "attributes": [
            {
              "description": "Icon key referenced by `$icons`.",
              "name": "data-key",
              "required": true,
              "type": "string"
            }
          ],
          "description": "One icon element.",
          "element": "*",
          "repeatable": true
        }
      ],
      "description": "Instance-level icon repository.",
      "element": "template",
      "id": "icons",
      "required": false,
      "selector": "template[data-fn=\"icons\"]"
    },
    {
      "attributes": [
        {
          "description": "Marks the template for deferred mounting (value: `template`).",
          "name": "data-fn",
          "required": true,
          "values": [
            "template"
          ]
        },
        {
          "description": "Re-parses the template when it mutates.",
          "name": "data-reactive",
          "required": false,
          "type": "boolean"
        }
      ],
      "description": "Deferred content template mounted by the base class.",
      "element": "template",
      "id": "template",
      "required": false,
      "selector": "template[data-fn=\"template\"]"
    }
  ],
  "cssClasses": [],
  "cssVars": [],
  "dataHooks": [
    {
      "appliesTo": "descendant",
      "attribute": "data-host-inner",
      "description": "Marks the rendered inner wrapper so `force-prevent-rerender` can adopt server-rendered DOM without re-rendering.",
      "from": "Hwc",
      "role": "config",
      "values": []
    },
    {
      "appliesTo": "descendant",
      "attribute": "data-reactive",
      "description": "Opts the marked child (config script, data source, icons, or template) into live re-parsing when its DOM mutates.",
      "from": "Hwc",
      "role": "config",
      "values": []
    }
  ],
  "events": [
    {
      "bubbles": true,
      "cancelable": true,
      "description": "Cancelable; fires before applying a value. Detail: `group`, `value`, `previousValue`, `config`.",
      "detail": {
        "fields": [
          {
            "name": "group",
            "type": "string"
          },
          {
            "name": "value",
            "type": "string"
          },
          {
            "name": "previousValue",
            "type": "string"
          },
          {
            "name": "config",
            "type": "{ [group: string]: string; }"
          }
        ],
        "type": "{ group: string; value: string; previousValue: string; config: { [group: string]: string; } }"
      },
      "name": "z-lsh:before-change"
    },
    {
      "bubbles": true,
      "cancelable": false,
      "description": "Fires after a value is applied and persisted, with the same detail; other instances sync from it.",
      "detail": {
        "fields": [
          {
            "name": "group",
            "type": "string"
          },
          {
            "name": "value",
            "type": "string"
          },
          {
            "name": "previousValue",
            "type": "string"
          },
          {
            "name": "config",
            "type": "{ [group: string]: string; }"
          }
        ],
        "type": "{ group: string; value: string; previousValue: string; config: { [group: string]: string; } }"
      },
      "name": "z-lsh:change"
    }
  ],
  "i18n": [
    {
      "default": "Active",
      "description": "Suffix appended when the value is active.",
      "key": "active-label",
      "placeholders": [],
      "usedIn": []
    },
    {
      "default": "Toggle theme",
      "description": "Base accessible label of the button.",
      "key": "aria-label",
      "placeholders": [],
      "usedIn": []
    },
    {
      "default": "Switch to dark mode",
      "description": "Toggle-mode label suffix when currently light.",
      "key": "switch-to-dark",
      "placeholders": [],
      "usedIn": []
    },
    {
      "default": "Switch to light mode",
      "description": "Toggle-mode label suffix when currently dark.",
      "key": "switch-to-light",
      "placeholders": [],
      "usedIn": []
    }
  ],
  "icons": [],
  "id": "lsh",
  "inherits": [
    "Hwc",
    "Base"
  ],
  "keyboard": [
    {
      "action": "Activates the toggle.",
      "keys": [
        "Enter",
        "Space"
      ]
    }
  ],
  "kind": "hwc",
  "methods": [],
  "notes": [
    "Configuration is stored under the `__Z_THEME__` localStorage key as a group → value map.",
    "Non-`mode` groups replace any existing class sharing the value's two-segment prefix (e.g. `theme-*`) on `<html>`.",
    "Button content comes from the shared deferred `template` child."
  ],
  "parts": {
    "defaultClsTarget": "button",
    "defaultStlTarget": "button",
    "items": [
      {
        "defaultCls": "z-lsh",
        "description": "The toggle button (default `z-lsh`); the default `cls`/`stl` target. Receives `z-active` while its value is active.",
        "foundIn": [
          "$cls",
          "render"
        ],
        "key": "button",
        "supportsCls": true,
        "supportsStl": true
      }
    ]
  },
  "recipes": [],
  "related": [],
  "schemaVersion": 1,
  "sources": {
    "css": [],
    "cssSelectors": [],
    "ts": "src/js/hwc/components/lsh.ts"
  },
  "summary": "Button that applies a theme/group value as a class on the document root, persisted in localStorage and synced across instances.",
  "tag": "z-lsh",
  "title": "Theme Toggle"
}
