Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x 1x | import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";
import { ui } from "@/config/theme";
import { cn } from "@/lib/utils";
const buttonVariants = cva(ui("buttonBase"), {
variants: {
variant: {
default: ui("buttonDefault"),
brand: ui("buttonBrand"),
destructive: ui("buttonDestructive"),
outline: ui("buttonOutline"),
},
size: { default: "h-10 px-4 py-2", sm: "h-9 px-3", icon: "h-9 w-9 shrink-0 p-0" },
},
defaultVariants: { variant: "default", size: "default" },
});
export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean;
}
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button";
return <Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />;
},
);
Button.displayName = "Button";
export { Button, buttonVariants };
|