Open this example in the interactive library
Live preview
Source code
// components/InlineHelpTooltipButton.tsx
import { useId } from "react";
export default function InlineHelpTooltipButton({
message = "Changes saved",
detail = "Your draft is up to date.",
}: { message?: string; detail?: string } = {}) {
const id = useId();
return (
<>
<button popoverTarget={id} aria-label={"Help: " + message}>
?
</button>
<p popover="auto" id={id}>
{detail}
</p>
</>
);
}
