diff --git a/src/components/Tooltip.tsx b/src/components/Tooltip.tsx new file mode 100644 index 0000000..d611691 --- /dev/null +++ b/src/components/Tooltip.tsx @@ -0,0 +1,40 @@ +import { ReactNode } from "react"; + +export interface TooltipProps { + /** + * Tooltip text - can be string or another component + */ + tooltipMessage: ReactNode; + /** + * The targeted component + */ + children: ReactNode; +} + +const Tooltip = ({ tooltipMessage, children }: TooltipProps) => { + return ( +
+ {/* Tooltip will be shown under the component(children) when the children is onHover */} + {children} + {/* Creating the tooltip and give it a postion */} +
+ {tooltipMessage} +
+
+ ); +}; + +export default Tooltip;