tasko/components/hint.tsx

36 lines
725 B
TypeScript
Raw Normal View History

2024-02-15 02:30:10 +00:00
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";
interface HintProps {
children: React.ReactNode;
description: string;
side?: "left" | "right" | "top" | "bottom";
sideOffset?: number;
}
export const Hint = ({
children,
description,
side = "bottom",
sideOffset = 0,
}: HintProps) => {
return (
<TooltipProvider>
<Tooltip delayDuration={0}>
<TooltipTrigger>{children}</TooltipTrigger>
<TooltipContent
sideOffset={sideOffset}
side={side}
className="text-xs max-w-[220px] break-words"
>
{description}
</TooltipContent>
</Tooltip>
</TooltipProvider>
);
};