useIsCursorOverPage
Returns whether the cursor is currently over a page, and re-renders the component when that changes. Useful for cursor-dependent UI, such as hints while placing content with the addText, addWidget, or addImage tools.
const isCursorOverPage = useIsCursorOverPage()Example
import { useInteractionTool, useIsCursorOverPage } from '@sdk-pdf/react'
function PlacementHint() {
const interactionTool = useInteractionTool()
const isCursorOverPage = useIsCursorOverPage()
if (interactionTool.type !== 'addText' || isCursorOverPage) return null
return <p>Move the cursor over a page to place the text.</p>
}