forked from sqlchat/sqlchat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTooltip.tsx
More file actions
34 lines (29 loc) · 880 Bytes
/
Tooltip.tsx
File metadata and controls
34 lines (29 loc) · 880 Bytes
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
31
32
33
34
import * as TooltipUI from "@radix-ui/react-tooltip";
type Side = "top" | "right" | "bottom" | "left";
interface Props {
title: string;
side: Side;
children: React.ReactNode;
}
const Tooltip = (props: Props) => {
const { title, side, children } = props;
return (
<TooltipUI.Provider delayDuration={0} skipDelayDuration={0}>
<TooltipUI.Root>
<TooltipUI.Trigger asChild>{children}</TooltipUI.Trigger>
<TooltipUI.Portal>
<TooltipUI.Content
className="bg-zinc-800 text-gray-200 dark:bg-black text-sm p-1 px-2 rounded-md z-[99999]"
side={side}
sideOffset={6}
hidden={title === ""}
>
{title}
<TooltipUI.Arrow />
</TooltipUI.Content>
</TooltipUI.Portal>
</TooltipUI.Root>
</TooltipUI.Provider>
);
};
export default Tooltip;