platform-bible-react
    Preparing search index...

    Function useTruncationTooltip

    • Drives a controlled tooltip that opens on hover only when the trigger element's text is actually truncated (its content overflows the visible box, i.e. scrollWidth > clientWidth). Useful for revealing the full text of a label that uses CSS truncation, without showing a redundant tooltip when the text already fits.

      Attach the returned ref to the truncating trigger element, spread onPointerEnter / onPointerLeave onto it, and pass open to a controlled Radix <Tooltip open={...}>.

      Type Parameters

      • T extends HTMLElement

        The type of the trigger element (e.g. HTMLSpanElement, HTMLDivElement).

      Returns UseTruncationTooltipResult<T>

      An object with ref, open, onPointerEnter, and onPointerLeave.