{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "UI8Kit 3 Button primitive (unstyled), from @ui8kit/registry",
  "devDependencies": [],
  "digest": "0.1.0",
  "files": [
    {
      "content": "// Code generated by @ui8kit/codegen. DO NOT EDIT.\n\n/*\nButton triggers an action. With `href` it renders an anchor (navigation that\nlooks like an action). Event handlers (onClick) flow through attrs/rest.\nPressed / Expanded are the semantic ARIA state props (toggle, disclosure).\n*/\n\npackage button\n\nimport (\n\t\"strconv\"\n\n\tuiutils \"github.com/ui8kit/codegen/generated/templ/utils\"\n)\n\n// ButtonProps configures Button.\ntype ButtonProps struct {\n\t// Class — token class names supplied by the consumer\n\tClass string\n\t// Type — button type (default button)\n\tType string\n\t// Form — associated form id (button mode)\n\tForm string\n\t// Href — renders an anchor when set\n\tHref string\n\t// Disabled — blocks interaction\n\tDisabled bool\n\t// Pressed — toggle state → aria-pressed (button mode); unset omits it\n\tPressed *bool\n\t// Expanded — disclosure state → aria-expanded; unset omits it\n\tExpanded *bool\n\tAriaLabel string\n\tAriaPressed string\n\tAriaExpanded string\n\tAriaControls string\n\tAttrs templ.Attributes\n}\n\n// ButtonClasses composes Button classes without rendering —\n// the server-composition escape hatch for custom root elements (no asChild in templ).\nfunc ButtonClasses(p ButtonProps) string {\n\treturn uiutils.Cn(p.Class)\n}\n\n// Button renders the Button contract.\ntempl Button(p ButtonProps) {\n\tif uiutils.IsSetStr(p.Href) {\n\t\t<a\n\t\t\tif !uiutils.HasAttr(p.Attrs, \"href\") {\n\t\t\t\tif uiutils.IsSetStr(uiutils.SafeURL(p.Href)) {\n\t\t\t\t\thref={ uiutils.SafeURL(p.Href) }\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ButtonClasses(p) != \"\" {\n\t\t\t\tclass={ ButtonClasses(p) }\n\t\t\t}\n\t\t\tif !uiutils.HasAttr(p.Attrs, \"aria-expanded\") {\n\t\t\t\tif !uiutils.IsSetStr(p.AriaExpanded) {\n\t\t\t\t\tif uiutils.IsSetStr(uiutils.OptBoolStr(p.Expanded)) {\n\t\t\t\t\t\taria-expanded={ uiutils.OptBoolStr(p.Expanded) }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !uiutils.HasAttr(p.Attrs, \"aria-label\") {\n\t\t\t\tif uiutils.IsSetStr(p.AriaLabel) {\n\t\t\t\t\taria-label={ p.AriaLabel }\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !uiutils.HasAttr(p.Attrs, \"aria-pressed\") {\n\t\t\t\tif uiutils.IsSetStr(p.AriaPressed) {\n\t\t\t\t\taria-pressed={ p.AriaPressed }\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !uiutils.HasAttr(p.Attrs, \"aria-expanded\") {\n\t\t\t\tif uiutils.IsSetStr(p.AriaExpanded) {\n\t\t\t\t\taria-expanded={ p.AriaExpanded }\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !uiutils.HasAttr(p.Attrs, \"aria-controls\") {\n\t\t\t\tif uiutils.IsSetStr(p.AriaControls) {\n\t\t\t\t\taria-controls={ p.AriaControls }\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !uiutils.HasAttr(p.Attrs, \"aria-disabled\") {\n\t\t\t\tif p.Disabled {\n\t\t\t\t\taria-disabled={ \"true\" }\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !uiutils.HasAttr(p.Attrs, \"tabindex\") {\n\t\t\t\tif p.Disabled {\n\t\t\t\t\ttabindex={ strconv.Itoa(int(-1)) }\n\t\t\t\t}\n\t\t\t}\n\t\t\t{ uiutils.RestAttrs(p.Attrs, false, \"aria-label\", \"aria-pressed\", \"aria-expanded\", \"aria-controls\")... }\n\t\t>\n\t\t\t{ children... }\n\t\t</a>\n\t} else {\n\t\t<button\n\t\t\tif !uiutils.HasAttr(p.Attrs, \"type\") {\n\t\t\t\ttype={ uiutils.OneOfOr(p.Type, \"button\", \"submit\", \"reset\") }\n\t\t\t}\n\t\t\tif ButtonClasses(p) != \"\" {\n\t\t\t\tclass={ ButtonClasses(p) }\n\t\t\t}\n\t\t\tif !uiutils.HasAttr(p.Attrs, \"disabled\") {\n\t\t\t\tdisabled?={ p.Disabled }\n\t\t\t}\n\t\t\tif !uiutils.HasAttr(p.Attrs, \"form\") {\n\t\t\t\tif uiutils.IsSetStr(p.Form) {\n\t\t\t\t\tform={ p.Form }\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !uiutils.HasAttr(p.Attrs, \"aria-pressed\") {\n\t\t\t\tif !uiutils.IsSetStr(p.AriaPressed) {\n\t\t\t\t\tif uiutils.IsSetStr(uiutils.OptBoolStr(p.Pressed)) {\n\t\t\t\t\t\taria-pressed={ uiutils.OptBoolStr(p.Pressed) }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !uiutils.HasAttr(p.Attrs, \"aria-expanded\") {\n\t\t\t\tif !uiutils.IsSetStr(p.AriaExpanded) {\n\t\t\t\t\tif uiutils.IsSetStr(uiutils.OptBoolStr(p.Expanded)) {\n\t\t\t\t\t\taria-expanded={ uiutils.OptBoolStr(p.Expanded) }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !uiutils.HasAttr(p.Attrs, \"aria-label\") {\n\t\t\t\tif uiutils.IsSetStr(p.AriaLabel) {\n\t\t\t\t\taria-label={ p.AriaLabel }\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !uiutils.HasAttr(p.Attrs, \"aria-pressed\") {\n\t\t\t\tif uiutils.IsSetStr(p.AriaPressed) {\n\t\t\t\t\taria-pressed={ p.AriaPressed }\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !uiutils.HasAttr(p.Attrs, \"aria-expanded\") {\n\t\t\t\tif uiutils.IsSetStr(p.AriaExpanded) {\n\t\t\t\t\taria-expanded={ p.AriaExpanded }\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !uiutils.HasAttr(p.Attrs, \"aria-controls\") {\n\t\t\t\tif uiutils.IsSetStr(p.AriaControls) {\n\t\t\t\t\taria-controls={ p.AriaControls }\n\t\t\t\t}\n\t\t\t}\n\t\t\t{ uiutils.RestAttrs(p.Attrs, false, \"form\", \"aria-label\", \"aria-pressed\", \"aria-expanded\", \"aria-controls\")... }\n\t\t>\n\t\t\t{ children... }\n\t\t</button>\n\t}\n}\n",
      "path": "ui/button/button.templ",
      "target": "ui/button/button.templ"
    }
  ],
  "meta": {
    "category": "kit",
    "kind": "primitive",
    "tags": [
      "templ",
      "primitive"
    ]
  },
  "name": "kit-button",
  "registryDependencies": [
    "utils"
  ],
  "runtime": "templ",
  "title": "Kit Button",
  "type": "registry:ui"
}
