aboutsummaryrefslogtreecommitdiff
path: root/packages/memory-graph/src/ui/badge.tsx
blob: 0708888f16d05cd3bec9ec2ade78ecfa998c3350 (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
import { Slot } from "@radix-ui/react-slot";
import type * as React from "react";
import { badge, type BadgeVariants } from "./badge.css";

function Badge({
	className,
	variant,
	asChild = false,
	...props
}: React.ComponentProps<"span"> &
	BadgeVariants & { asChild?: boolean }) {
	const Comp = asChild ? Slot : "span";

	const combinedClassName = className
		? `${badge({ variant })} ${className}`
		: badge({ variant });

	return (
		<Comp
			className={combinedClassName}
			data-slot="badge"
			{...props}
		/>
	);
}

export { Badge, badge as badgeVariants };