blob: 89015299062c6aeb9bb64850e9d9c3e9176b5123 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import { Slot } from "@radix-ui/react-slot"
import type * as React from "react"
import { button, type ButtonVariants } from "./button.css"
function Button({
className,
variant,
size,
asChild = false,
...props
}: React.ComponentProps<"button"> &
ButtonVariants & {
asChild?: boolean
}) {
const Comp = asChild ? Slot : "button"
const combinedClassName = className
? `${button({ variant, size })} ${className}`
: button({ variant, size })
return <Comp className={combinedClassName} data-slot="button" {...props} />
}
export { Button, button as buttonVariants }
|