Files
monorepo/baseball/src/components/ui/button.tsx
T
2026-05-06 15:51:10 +00:00

41 lines
1.4 KiB
TypeScript

import * as React from "react";
import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/lib/utils";
const buttonVariants = cva(
"inline-flex items-center justify-center rounded-full text-sm font-semibold transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ring-offset-background",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground shadow-panel hover:bg-primary/90",
secondary: "bg-card text-foreground border border-border hover:bg-muted",
ghost: "text-muted-foreground hover:bg-muted hover:text-foreground",
destructive: "bg-destructive text-destructive-foreground shadow-panel hover:bg-destructive/90"
},
size: {
default: "h-11 px-5",
sm: "h-9 px-4 text-xs",
lg: "h-12 px-6",
icon: "h-10 w-10 rounded-full"
}
},
defaultVariants: {
variant: "default",
size: "default"
}
}
);
export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {}
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, ...props }, ref) => (
<button ref={ref} className={cn(buttonVariants({ variant, size }), className)} {...props} />
)
);
Button.displayName = "Button";
export { Button, buttonVariants };