{
  "$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// ui.button — shared TypeScript contract (types + classes helpers)\n\nimport { cn } from \"../../utils\";\n\n/** Button renders a button element, or an anchor when Href is set. */\nexport type ButtonBaseProps = {\n  type?: \"button\" | \"submit\" | \"reset\";\n  href?: string;\n  disabled?: boolean;\n  pressed?: boolean;\n  expanded?: boolean;\n};\n\nexport type ButtonClassesInput = {\n  className?: string;\n};\n\n/** Compose Button classes without rendering — the cross-runtime `asChild` substitute. */\nexport function buttonClasses(input: ButtonClassesInput = {}): string {\n  return cn(input.className);\n}\n",
      "path": "kit/ui/button/button.shared.ts",
      "target": "kit/ui/button/button.shared.ts"
    },
    {
      "content": "// Code generated by @ui8kit/codegen. DO NOT EDIT.\n/**\n * Button triggers an action. With `href` it renders an anchor (navigation that\n * looks like an action). Event handlers (onClick) flow through attrs/rest.\n * Pressed / Expanded are the semantic ARIA state props (toggle, disclosure).\n */\n\nimport { forwardRef, type ReactNode, type AnchorHTMLAttributes, type ButtonHTMLAttributes, type Ref } from \"react\";\nimport { buttonClasses } from \"./button.shared\";\nimport { isSetStr, oneOfOr, optBoolStr, orUndef, safeRest, safeUrl } from \"../../utils/expr\";\nimport { Slot } from \"../slot/slot\";\n\n/**\n * Button renders a button element, or an anchor when Href is set.\n * Type/Form apply only in button mode; Disabled on anchors uses aria-disabled.\n * Pressed (button mode) and Expanded print aria-pressed / aria-expanded as \"true\"/\"false\";\n * unset omits the attribute.\n */\nexport type ButtonProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement> & ButtonHTMLAttributes<HTMLButtonElement>, \"className\" | \"children\" | \"type\" | \"href\" | \"disabled\" | \"pressed\" | \"expanded\"> & {\n  type?: \"button\" | \"submit\" | \"reset\";\n  href?: string;\n  disabled?: boolean;\n  pressed?: boolean;\n  expanded?: boolean;\n  className?: string;\n  children?: ReactNode;\n  asChild?: boolean;\n};\n\nexport const Button = forwardRef<HTMLAnchorElement | HTMLButtonElement, ButtonProps>(function Button(\n  { type, href, disabled, pressed, expanded, className, children, asChild, ...rawRest },\n  ref\n) {\n  const rest = safeRest(rawRest, { blank: [\"aria-label\", \"aria-pressed\", \"aria-expanded\", \"aria-controls\"] });\n  const cls = buttonClasses({ className });\n  if (asChild) {\n    return (\n      <Slot ref={ref} className={cls} {...rest}>\n        {children}\n      </Slot>\n    );\n  }\n  return (\n    isSetStr(href) ? (\n      <a ref={ref as Ref<HTMLAnchorElement>} href={orUndef(safeUrl(href))} className={cls || undefined} aria-expanded={orUndef(optBoolStr(expanded))} aria-disabled={disabled ? \"true\" : undefined} tabIndex={disabled ? -1 : undefined} {...rest}>\n        {children}\n      </a>\n    ) : (\n      <button ref={ref as Ref<HTMLButtonElement>} type={oneOfOr(type, \"button\", \"submit\", \"reset\")} className={cls || undefined} disabled={disabled} aria-pressed={orUndef(optBoolStr(pressed))} aria-expanded={orUndef(optBoolStr(expanded))} {...rest}>\n        {children}\n      </button>\n    )\n  );\n});\nButton.displayName = \"Button\";\n",
      "path": "kit/ui/button/button.tsx",
      "target": "kit/ui/button/button.tsx"
    }
  ],
  "meta": {
    "category": "kit",
    "kind": "primitive",
    "tags": [
      "react",
      "primitive"
    ]
  },
  "name": "kit-button",
  "registryDependencies": [
    "kit-slot",
    "utils"
  ],
  "runtime": "react",
  "title": "Kit Button",
  "type": "registry:ui"
}
