aboutsummaryrefslogtreecommitdiff
path: root/packages/memory-graph/src/ui/badge.tsx
blob: a08578c3655094fe8df773dfacc45b9a66508d45 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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 }