# Clickaway

This directive triggers user function on click outside of element directive is attached to.

# Features

  • Use click or other event as a trigger
  • Disable listener by passing a falsy value

# Usage

Example with function triggered on every outside click:

<!-- hideElement method is called on every click outside of 'div' element -->
<div v-c-clickaway="hideElement">
  [...]
</div>

Example with function triggered on every outside click, only if 'elementVisible' is truthy:

<div v-c-clickaway="elementVisible ? hideElement : null">
  [...]
</div>

# Event type

Custom event name is defined by directive argument.

<div v-c-clickaway:doubleClick="hideElement">
  [...]
</div>