{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "UI8Kit 3 Switch primitive (unstyled), from @ui8kit/registry",
  "devDependencies": [],
  "digest": "0.1.0",
  "files": [
    {
      "content": "// Code generated by @ui8kit/codegen. DO NOT EDIT.\n\n/*\nSwitch is an on/off toggle: button[role=switch] with aria-checked.\nState changes are the consumer's (onClick via attrs/rest).\n*/\n\npackage formswitch\n\nimport (\n\tuiutils \"github.com/ui8kit/codegen/generated/templ/utils\"\n)\n\n// SwitchProps configures Switch.\ntype SwitchProps struct {\n\t// Class — token class names supplied by the consumer\n\tClass string\n\tChecked bool\n\tDisabled bool\n\tID string\n\tName string\n\tValue *string\n\tAriaLabel string\n\tAriaLabelledBy string\n\tAttrs templ.Attributes\n}\n\n// SwitchClasses composes Switch classes without rendering —\n// the server-composition escape hatch for custom root elements (no asChild in templ).\nfunc SwitchClasses(p SwitchProps) string {\n\treturn uiutils.Cn(p.Class)\n}\n\n// Switch renders the Switch contract.\ntempl Switch(p SwitchProps) {\n\t<button\n\t\tif !uiutils.HasAttr(p.Attrs, \"type\") {\n\t\t\ttype=\"button\"\n\t\t}\n\t\tif !uiutils.HasAttr(p.Attrs, \"role\") {\n\t\t\trole=\"switch\"\n\t\t}\n\t\tif !uiutils.HasAttr(p.Attrs, \"aria-checked\") {\n\t\t\taria-checked={ uiutils.BoolStr(p.Checked) }\n\t\t}\n\t\tif !uiutils.HasAttr(p.Attrs, \"data-state\") {\n\t\t\tdata-state={ uiutils.BoolStr(p.Checked) }\n\t\t}\n\t\tif SwitchClasses(p) != \"\" {\n\t\t\tclass={ SwitchClasses(p) }\n\t\t}\n\t\tif !uiutils.HasAttr(p.Attrs, \"disabled\") {\n\t\t\tdisabled?={ p.Disabled }\n\t\t}\n\t\tif !uiutils.HasAttr(p.Attrs, \"id\") {\n\t\t\tif uiutils.IsSetStr(p.ID) {\n\t\t\t\tid={ p.ID }\n\t\t\t}\n\t\t}\n\t\tif !uiutils.HasAttr(p.Attrs, \"name\") {\n\t\t\tif uiutils.IsSetStr(p.Name) {\n\t\t\t\tname={ p.Name }\n\t\t\t}\n\t\t}\n\t\tif !uiutils.HasAttr(p.Attrs, \"value\") {\n\t\t\tif p.Value != nil {\n\t\t\t\tvalue={ *p.Value }\n\t\t\t}\n\t\t}\n\t\tif !uiutils.HasAttr(p.Attrs, \"aria-label\") {\n\t\t\tif uiutils.IsSetStr(p.AriaLabel) {\n\t\t\t\taria-label={ p.AriaLabel }\n\t\t\t}\n\t\t}\n\t\tif !uiutils.HasAttr(p.Attrs, \"aria-labelledby\") {\n\t\t\tif uiutils.IsSetStr(p.AriaLabelledBy) {\n\t\t\t\taria-labelledby={ p.AriaLabelledBy }\n\t\t\t}\n\t\t}\n\t\t{ uiutils.RestAttrs(p.Attrs, false, \"id\", \"name\", \"aria-label\", \"aria-labelledby\")... }\n\t>\n\t\t{ children... }\n\t</button>\n}\n",
      "path": "ui/switch/switch.templ",
      "target": "ui/switch/switch.templ"
    }
  ],
  "meta": {
    "category": "kit",
    "kind": "primitive",
    "tags": [
      "templ",
      "primitive"
    ]
  },
  "name": "kit-switch",
  "registryDependencies": [
    "utils"
  ],
  "runtime": "templ",
  "title": "Kit Switch",
  "type": "registry:ui"
}
