useOnClickAway

Detects clicks outside specified elements and invokes a handler.

Detects clicks outside specified elements and invokes a handler. The listener can be toggled on and off, and multiple exclusion refs are supported.

Import#

import { useOnClickAway } from '@volue/wave-react';

Example#


API reference#

Arguments#

Prop
Type
Default
handler*
((event: Event) => void) | null
—
isActive*
boolean
—
...refs*
RefObject<HTMLElement>[]
—

Returns#

void