Castle logo

CASTLE UI

search

Search

⌘K
hexagon

useOutsideClick is a custom hook that handles click events outside a specific DOM element, like a div. A handler is invoked when a click or touch event happens outside the referenced element.

This hook is compatible with mouse and touch events.

Import

import { useOutsideClick } from '@passfort/castle'
content_copy

Copy

Usage

content_copy

Copy

live example

Contents