Gathering detailed insights and metrics for vue3-clickout
Gathering detailed insights and metrics for vue3-clickout
Gathering detailed insights and metrics for vue3-clickout
Gathering detailed insights and metrics for vue3-clickout
A directive that allows you to call a function when you click outside the active area of an element.
npm install vue3-clickout
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
ISC License
3 Stars
20 Commits
1 Forks
1 Watchers
1 Branches
1 Contributors
Updated on Aug 31, 2023
Latest Version
1.1.1
Package Id
vue3-clickout@1.1.1
Unpacked Size
7.22 kB
Size
2.92 kB
File Count
6
NPM Version
8.15.0
Node Version
16.18.1
Published on
Apr 27, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
1
A directive that allows you to call a function when you click outside the active area of an element. The active area of an element is the element itself and any descendant nested within it.
npm i vue3-clickout
When registered globally, the directive will be available throughout the project. This means that you can use it in any component without the need for additional imports.
In main.js:
1import { createApp } from 'vue'; 2import App from './App.vue'; 3 4import vClickout from 'vue3-clickout'; 5 6createApp(App) 7 .use(vClickout) 8 .mount('#app');
When registering locally, the directive will be available for use only in the component where it was registered.
In any component:
1<script> 2import vClickout from "vue3-clickout"; 3 4export default { 5 directives: { 6 clickout: vClickout 7 } 8} 9</script>
When clicked in the active area, the class v-clickout-active
is added to the element, otherwise it is removed.
The data that is passed to the callback function is an object with an element and an event: { el, event }
1<template> 2 <div v-clickout="clickOutside"> 3 ... 4 </div> 5</template> 6 7<script> 8export default { 9 methods: { 10 clickOutside(event) { 11 console.log(event); // event = { el, event } 12 } 13 } 14} 15</script>
clickOutside
- callback function to execute after clicking outside the active area of the element.
1<template> 2 <div v-clickout="clickOutside"> 3 ... 4 </div> 5</template> 6 7<script> 8export default { 9 setup() { 10 const clickOutside = event => { 11 console.log(event); // event = { el, event } 12 } 13 14 return { clickOutside } 15 } 16} 17</script>
By default, a method or function is passed to a directive:
<div v-clickout="clickOutsideFunction">
If you need to pass arguments, then you need to pass it as an object:
<div v-clickout="{event: clickOutsideFunction}">
Analogue of the default behavior. Only method passed.
<div v-clickout="{event: clickOutsideFunction, active: true}">
The element will be considered active immediately, as if you had already clicked on it. This can be useful if the target element is immediately displayed on the page waiting for the callback to be called (for example, when entering the page, there may already be a modal window or some other pop-up block).
• The directive class is immediately added to the target element
<div v-clickout="{event: clickOutsideFunction, always: true}">
The element will always be considered active. The callback will ALWAYS be fired on every click outside of the target element. This can be useful if you need to point the user to some interactive part of the page where his participation is required and without which further actions are impossible. Or any other special occasion.
• The directive class is always added to the target element
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/20 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More