{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "button", "type": "registry:ui", "description": "Primary action triggers with multiple variants and loading states", "dependencies": [ "@radix-ui/react-slot", "class-variance-authority" ], "registryDependencies": [], "files": [ { "path": "registry/new-york/button/button.tsx", "content": "import * as React from \"react\"\nimport { Slot } from \"@radix-ui/react-slot\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all duration-300 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-ember focus-visible:ring-2\",\n {\n variants: {\n variant: {\n default: \"bg-ember text-fineshyt hover:bg-ember/90\",\n destructive:\n \"bg-ember/80 text-fineshyt hover:bg-ember/70 focus-visible:ring-ember/40\",\n outline:\n \"border-2 border-winedusk/50 bg-transparent text-fineshyt hover:bg-winedusk/20 hover:border-winedusk\",\n secondary:\n \"bg-winedusk text-fineshyt hover:bg-winedusk/80\",\n ghost:\n \"text-fineshyt hover:bg-winedusk/50 hover:text-fineshyt\",\n link: \"text-fineshyt/80 underline-offset-4 hover:underline hover:text-fineshyt\",\n },\n size: {\n default: \"h-9 px-4 py-2 has-[>svg]:px-3\",\n sm: \"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5\",\n lg: \"h-10 rounded-md px-6 has-[>svg]:px-4\",\n icon: \"size-9\",\n \"icon-sm\": \"size-8\",\n \"icon-lg\": \"size-10\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes,\n VariantProps {\n asChild?: boolean\n loading?: boolean\n leftIcon?: React.ReactNode\n rightIcon?: React.ReactNode\n}\n\nconst Button = React.forwardRef(\n ({ className, variant, size, asChild = false, loading, leftIcon, rightIcon, children, disabled, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\"\n\n return (\n \n {loading && (\n \n \n \n \n )}\n {leftIcon && {leftIcon}}\n {children}\n {rightIcon && {rightIcon}}\n \n )\n }\n)\nButton.displayName = \"Button\"\n\nexport { Button, buttonVariants }\n", "type": "registry:ui" } ] }