37 lines
877 B
TypeScript
37 lines
877 B
TypeScript
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
import React from "react";
|
|
|
|
export function Tooltip({
|
|
children,
|
|
content,
|
|
open,
|
|
defaultOpen,
|
|
onOpenChange,
|
|
...props
|
|
}: {
|
|
children: React.ReactNode;
|
|
content: React.ReactNode;
|
|
open?: boolean;
|
|
defaultOpen?: boolean;
|
|
onOpenChange?: (open: boolean) => void;
|
|
}) {
|
|
return (
|
|
<TooltipPrimitive.Root
|
|
delayDuration={50}
|
|
open={open}
|
|
defaultOpen={defaultOpen}
|
|
onOpenChange={onOpenChange}>
|
|
<TooltipPrimitive.Trigger asChild>{children}</TooltipPrimitive.Trigger>
|
|
<TooltipPrimitive.Content
|
|
className="-mt-2 rounded-md bg-gray-900 px-2 py-1 text-xs font-semibold text-white shadow-lg"
|
|
side="top"
|
|
align="center"
|
|
{...props}>
|
|
{content}
|
|
</TooltipPrimitive.Content>
|
|
</TooltipPrimitive.Root>
|
|
);
|
|
}
|
|
|
|
export default Tooltip;
|