import * as React from "react"; import { Slot } from "@radix-ui/react-slot"; import { cva, type VariantProps } from "class-variance-authority"; import { cn } from "@/lib/utils"; const buttonVariants = cva( "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-all focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", { variants: { variant: { default: "bg-primary text-primary-foreground hover:bg-primary/85", outline: "border border-border bg-transparent text-foreground hover:bg-accent/60", secondary: "bg-secondary text-secondary-foreground hover:bg-accent", ghost: "text-muted-foreground hover:bg-accent/60 hover:text-foreground", destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20", link: "text-foreground underline-offset-4 hover:underline", }, size: { default: "h-10 px-5 py-2", sm: "h-8 rounded-md px-3 text-xs", lg: "h-12 rounded-md px-8", icon: "h-10 w-10", }, }, defaultVariants: { variant: "default", size: "default", }, }, ); export interface ButtonProps extends React.ButtonHTMLAttributes, VariantProps { asChild?: boolean; } const Button = React.forwardRef( ({ className, variant, size, asChild = false, ...props }, ref) => { const Comp = asChild ? Slot : "button"; return ( ); }, ); Button.displayName = "Button"; export { Button, buttonVariants };