2021-08-07 12:02:01 +00:00
|
|
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
2021-09-22 19:52:38 +00:00
|
|
|
import React from "react";
|
2021-08-07 12:02:01 +00:00
|
|
|
|
|
|
|
export function Tooltip({
|
|
|
|
children,
|
|
|
|
content,
|
|
|
|
open,
|
|
|
|
defaultOpen,
|
|
|
|
onOpenChange,
|
|
|
|
...props
|
|
|
|
}: {
|
|
|
|
children: React.ReactNode;
|
|
|
|
content: React.ReactNode;
|
2021-09-24 15:03:28 +00:00
|
|
|
open?: boolean;
|
|
|
|
defaultOpen?: boolean;
|
|
|
|
onOpenChange?: (open: boolean) => void;
|
2021-08-07 12:02:01 +00:00
|
|
|
}) {
|
|
|
|
return (
|
|
|
|
<TooltipPrimitive.Root
|
2022-04-29 17:17:34 +00:00
|
|
|
delayDuration={50}
|
2021-08-07 12:02:01 +00:00
|
|
|
open={open}
|
|
|
|
defaultOpen={defaultOpen}
|
|
|
|
onOpenChange={onOpenChange}>
|
2021-09-14 08:20:24 +00:00
|
|
|
<TooltipPrimitive.Trigger asChild>{children}</TooltipPrimitive.Trigger>
|
2021-08-07 12:02:01 +00:00
|
|
|
<TooltipPrimitive.Content
|
2022-05-05 21:16:25 +00:00
|
|
|
className="-mt-2 rounded-sm bg-black px-1 py-0.5 text-xs text-white shadow-lg"
|
2021-08-07 12:02:01 +00:00
|
|
|
side="top"
|
|
|
|
align="center"
|
|
|
|
{...props}>
|
|
|
|
{content}
|
|
|
|
</TooltipPrimitive.Content>
|
|
|
|
</TooltipPrimitive.Root>
|
|
|
|
);
|
|
|
|
}
|
2022-05-06 21:59:15 +00:00
|
|
|
|
|
|
|
export default Tooltip;
|