aboutsummaryrefslogtreecommitdiff
path: root/packages/memory-graph/src/ui/button.tsx
blob: 031f2cc81594cd330e7bec8b352ac07beedf9471 (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
25
26
27
28
29
30
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 };