Something went wrong. Try again.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253import { Slot } from "@radix-ui/react-slot";import { cva, type VariantProps } from "class-variance-authority";import type * as React from "react";
import { cn } from "@/lib/utils";
const buttonVariants = cva( "inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-1 focus-visible:ring-ring", { variants: { variant: { default: "bg-foreground text-background border-0 hover:bg-background hover:text-foreground", destructive: "bg-destructive text-destructive-foreground border-0 hover:bg-transparent hover:text-destructive", outline: "bg-transparent text-foreground border-0 hover:bg-secondary hover:text-secondary-foreground", secondary: "bg-secondary text-secondary-foreground border-0 hover:bg-accent", ghost: "bg-transparent text-foreground border-0 hover:bg-secondary", link: "bg-transparent text-foreground underline-offset-4 hover:underline border-none", }, size: { default: "h-8 px-4 py-1 text-[13px] has-[>svg]:px-3", xs: "h-6 gap-1 px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3", sm: "h-7 gap-1.5 px-3 text-xs has-[>svg]:px-2.5", lg: "h-9 px-5 text-[13px] has-[>svg]:px-4", icon: "size-8", "icon-xs": "size-6 [&_svg:not([class*='size-'])]:size-3", "icon-sm": "size-7", "icon-lg": "size-9", }, }, defaultVariants: { variant: "default", size: "default", }, },);
function Button({ className, variant = "default", size = "default", asChild = false, ...props}: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & { asChild?: boolean; }) { const Comp = asChild ? Slot : "button";
return <Comp data-slot="button" data-variant={variant} data-size={size} className={cn(buttonVariants({ variant, size, className }))} {...props} />;}
export { Button };