This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
scoresaber-reloadedv3/projects/website/src/components/tooltip.tsx

33 lines
730 B
TypeScript
Raw Normal View History

import { Tooltip as ShadCnTooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
2024-09-12 16:52:01 +00:00
type Props = {
/**
* What will trigger the tooltip
*/
children: React.ReactNode;
/**
* What will be displayed in the tooltip
*/
display: React.ReactNode;
2024-09-27 22:04:14 +00:00
2024-10-12 23:41:39 +00:00
/**
* Display the trigger as a child element.
*/
asChild?: boolean;
2024-09-27 22:04:14 +00:00
/**
* Where the tooltip will be displayed
*/
side?: "top" | "bottom" | "left" | "right";
2024-09-12 16:52:01 +00:00
};
2024-10-12 23:41:39 +00:00
export default function Tooltip({ children, display, asChild = true, side = "top" }: Props) {
2024-09-12 16:52:01 +00:00
return (
<ShadCnTooltip>
2024-10-12 23:41:39 +00:00
<TooltipTrigger asChild={asChild}>{children}</TooltipTrigger>
2024-09-27 22:04:14 +00:00
<TooltipContent side={side}>{display}</TooltipContent>
2024-09-12 16:52:01 +00:00
</ShadCnTooltip>
);
}