{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "button",
  "title": "Button",
  "author": "zyx1121 (https://github.com/zyx1121)",
  "description": "Button in one 40px height: variants default, outline, ghost, destructive; sizes default and icon.",
  "dependencies": [
    "@base-ui/react",
    "class-variance-authority",
    "cn"
  ],
  "registryDependencies": [
    "https://ui.zyx.tw/r/utils.json",
    "https://ui.zyx.tw/r/frame.json"
  ],
  "files": [
    {
      "path": "registry/zyx/components/ui/button.tsx",
      "content": "import { Button as ButtonPrimitive } from \"@base-ui/react/button\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"../../lib/utils\"\nimport { FrameEdges } from \"./frame\"\n\n// One height for text and icon buttons; variants follow what the zyx.tw apps use.\nconst buttonVariants = cva(\n  \"inline-flex h-10 shrink-0 items-center justify-center gap-2 rounded-control text-body font-medium whitespace-nowrap transition-[color,background-color,scale] duration-state outline-none select-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 motion-safe:active:scale-98 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n  {\n    variants: {\n      variant: {\n        default:\n          \"bg-primary text-primary-foreground hover:bg-primary/90 focus-visible:ring-primary/50 active:bg-primary/80\",\n        outline:\n          \"group/outline relative bg-transparent focus-visible:ring-0 active:bg-muted\",\n        ghost: \"hover:bg-muted active:bg-muted\",\n        destructive:\n          \"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:ring-destructive/20 active:bg-destructive/25\",\n      },\n      size: {\n        default: \"px-4\",\n        icon: \"w-10\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n      size: \"default\",\n    },\n  }\n)\n\n// An outline button is framed in glyphs; hovering lights the frame up.\n// Pressing any button inverts its cell, as a terminal highlights a key.\nfunction Button({\n  className,\n  variant,\n  size,\n  children,\n  ...props\n}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {\n  return (\n    <ButtonPrimitive\n      data-slot=\"button\"\n      className={cn(buttonVariants({ variant, size, className }))}\n      {...props}\n    >\n      {children}\n      {variant === \"outline\" && (\n        <FrameEdges className=\"text-muted-foreground opacity-20 transition duration-state group-hover/outline:text-foreground group-hover/outline:opacity-100 group-focus-visible/outline:text-ring group-focus-visible/outline:opacity-100\" />\n      )}\n    </ButtonPrimitive>\n  )\n}\n\nexport { Button, buttonVariants }\n",
      "type": "registry:ui"
    }
  ],
  "meta": {
    "useWhen": "Every action: one 40px height; default for the primary, ghost or outline for the rest.",
    "notFor": "Navigation between pages; use a link.",
    "related": [
      "toggle",
      "spinner"
    ]
  },
  "docs": "Use when: Every action: one 40px height; default for the primary, ghost or outline for the rest.\nNot for: Navigation between pages; use a link.\nGuide: https://ui.zyx.tw/button.md",
  "categories": [
    "control",
    "form"
  ],
  "type": "registry:ui"
}