@financial-times/o3-tooltip
Version:
Provides a viewport-aware tooltip for annotating or or highlighting other aspects of a product's UI
35 lines (34 loc) • 615 B
JavaScript
import { jsx } from "react/jsx-runtime";
import { useEffect, useRef } from "react";
function TooltipOnboarding({
id,
targetId,
placement = "top",
content,
title,
contentId,
onClose
}) {
const ref = useRef(null);
useEffect(() => {
if (!ref.current) return;
ref.current.onClose = onClose;
}, [onClose]);
return /* @__PURE__ */ jsx(
"o3-tooltip-onboarding",
{
id,
ref,
role: "tooltip",
placement,
"target-id": targetId,
class: "o3-tooltip",
content,
title,
"content-id": contentId
}
);
}
export {
TooltipOnboarding
};