SSE Hooks

useClickAnyWhere

GitHub
Custom hook that handles click events anywhere on the document.

Installation

npx sse-hooks add use-click-any-where

Usage

example.ts
import { useClickAnyWhere } from "./{hooks file}";

const handleClick = (event) => {
  console.log("Document clicked!", event);
};

// Attach click event handler to document
useClickAnywhere(handleClick);

API

Parameters

Prop Default Type
handler-

(event: MouseEvent) => void

The function to be called when a click event is detected anywhere on the document.

Returns

Return Value Default Type
return-

void

Hook return value

Types Aliases

No specific type aliases defined for this component.

Changelog

c165d — feat: enhance useRoleGuard and useSSR hooks with additional options and documentation

30da4 — feat: add new hooks and their metadata

cf13e — feat: add custom hooks for step navigation, ternary dark mode, timeout, toggle, unmount, and window size

Built with Love • © 2026