Vize

page-leave

Detect when the mouse leaves the page (for exit-intent UI).

Package @vizejs/composable/page-leave
Own the source vize lib pull composable:page-leave
Runtime exports usePageLeave
Gzip budget 1280 B

Usage

import { usePageLeave } from "@vizejs/composable/page-leave";

Runtime contract

Utility Category Stability SSR Hydration Cleanup Targets Host globals Uses
usePageLeave events experimental deterministic-fallback stable reactive-scope web, desktop window tryOnScopeDispose

API

usePageLeave

Detect when the mouse leaves the page (for exit-intent UI). A mouseout without a relatedTarget means the pointer left the document; any mouseover means it came back. Server renders report false; listeners are removed with the owning reactive scope.

function usePageLeave(options: UsePageLeaveOptions = {}): Readonly<Ref<boolean>>

Types

UsePageLeaveOptions

Options for usePageLeave.

Member Type Description
host? MaybeRefOrGetter<EventTarget | null | undefined> Window-like target that receives mouseout/mouseover.