{"id":20279316,"url":"https://github.com/mrastiak/vue-clickout","last_synced_at":"2026-07-29T20:31:03.293Z","repository":{"id":57395253,"uuid":"161478492","full_name":"mrastiak/vue-clickout","owner":"mrastiak","description":"Reusable clickout directive for reusable Vue.js components. forked from vue-clickaway","archived":false,"fork":false,"pushed_at":"2018-12-13T07:07:34.000Z","size":66,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-02-19T07:54:12.056Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrastiak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-12T11:28:38.000Z","updated_at":"2020-04-01T04:08:57.000Z","dependencies_parsed_at":"2022-09-02T15:23:28.751Z","dependency_job_id":null,"html_url":"https://github.com/mrastiak/vue-clickout","commit_stats":null,"previous_names":["carrene/vue-clickout"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mrastiak/vue-clickout","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrastiak%2Fvue-clickout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrastiak%2Fvue-clickout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrastiak%2Fvue-clickout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrastiak%2Fvue-clickout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrastiak","download_url":"https://codeload.github.com/mrastiak/vue-clickout/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrastiak%2Fvue-clickout/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":36049371,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-29T02:00:04.910Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T13:29:29.357Z","updated_at":"2026-07-29T20:31:03.259Z","avatar_url":"https://github.com/mrastiak.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vue-clickout\n\n\u003e Reusable clickout directive for reusable [Vue.js](https://github.com/vuejs/vue) components. forked from [vue-clickaway](https://github.com/simplesmiler/vue-clickaway)\n\n[![npm version](https://img.shields.io/npm/v/vue-clickout.svg)](https://www.npmjs.com/package/vue-clickout)\n\n## Overview\n\nSometimes you need to detect clicks **outside** of the element (to close a modal\nwindow or hide a dropdown select). There is no native event for that, and Vue.js\ndoes not cover you either. This is why `vue-clickout` exists.\n\n## Why not [vue-clickaway](https://github.com/simplesmiler/vue-clickaway)?\n\nThis library is forked from [vue-clickaway](https://github.com/simplesmiler/vue-clickaway). The main reason for creating a separate library is lack of some features in the vue-clickaway. for example `stop` modifier for `stopPropagation` support and `capture` for capturing support.\n\n## Requirements\n\n- vue: ^2.0.0\n\n## Install\n\n```sh\n$ npm install vue-clickout --save\n```\n\n## Usage\n\n1. Make the directive available to your component\n2. Define a method to be called\n3. Use the directive in the template\n\nThe recommended way is to use the mixin:\n\n```js\nimport { mixin as clickout } from 'vue-clickout'\n\nexport default {\n  mixins: [clickout],\n  template: '\u003cp v-on-clickout=\"out\"\u003eClick out\u003c/p\u003e',\n  methods: {\n    out: function() {\n      console.log('clicked out')\n    }\n  }\n}\n```\n\nIf mixin does not suit your needs, you can use the directive directly:\n\n```js\nimport { directive as onClickout } from 'vue-clickout'\n\nexport default {\n  directives: {\n    onClickout: onClickout\n  },\n  template: '\u003cp v-on-clickout=\"out\"\u003eClick out\u003c/p\u003e',\n  methods: {\n    out: function() {\n      console.log('clicked out')\n    }\n  }\n}\n```\n\n## Caveats\n\n1. Pay attention to the letter case. `onClickout` turns into `v-on-clickout`,\n   while `onClickOut` turns into `v-on-click-out`.\n2. Prior to `vue@^2.0`, directive were able to accept statements.\n   This is no longer the case. If you need to pass arguments, just do\n   `v-on-clickout=\"() =\u003e out(arg1)\"`.\n3. There is a common issue with dropdowns (and modals) inside an element with\n   `v-on-clickout`. Some UI libraries chose to implement these UI elements\n   by attaching the DOM element directly to the body. This makes clicks on\n   a dropped element trigger away handler. To combat that, you have to add\n   an extra check in the handler, for where the event originated from.\n   See #9 for an example.\n\n## License\n\n[MIT](https://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrastiak%2Fvue-clickout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrastiak%2Fvue-clickout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrastiak%2Fvue-clickout/lists"}