@supunlakmal/hooks
Version:
A collection of reusable React hooks
22 lines (21 loc) • 893 B
TypeScript
interface MousePosition {
/** The X coordinate of the mouse pointer relative to the viewport. */
x: number | null;
/** The Y coordinate of the mouse pointer relative to the viewport. */
y: number | null;
/** The X coordinate of the mouse pointer relative to the screen. */
screenX: number | null;
/** The Y coordinate of the mouse pointer relative to the screen. */
screenY: number | null;
/** The X coordinate of the mouse pointer relative to the whole document. */
pageX: number | null;
/** The Y coordinate of the mouse pointer relative to the whole document. */
pageY: number | null;
}
/**
* Custom hook to track the current position of the mouse pointer.
*
* @returns An object containing the mouse coordinates (relative to viewport, screen, and page).
*/
export declare function useMousePosition(): Readonly<MousePosition>;
export {};