{"id":18775866,"url":"https://github.com/andreoav/click-outside-hook","last_synced_at":"2025-04-13T09:31:28.155Z","repository":{"id":34200471,"uuid":"171470069","full_name":"andreoav/click-outside-hook","owner":"andreoav","description":"A simple react hook to detect click or touch events outside an element.","archived":false,"fork":false,"pushed_at":"2023-07-21T14:51:11.000Z","size":2121,"stargazers_count":29,"open_issues_count":51,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-09-20T07:17:43.242Z","etag":null,"topics":["click-outside","hooks","react","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/andreoav.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-19T12:30:10.000Z","updated_at":"2023-07-25T23:44:39.000Z","dependencies_parsed_at":"2024-06-19T00:26:52.305Z","dependency_job_id":"fd1ff6f3-cf50-4750-a237-a67f7fa2bc3c","html_url":"https://github.com/andreoav/click-outside-hook","commit_stats":{"total_commits":19,"total_committers":4,"mean_commits":4.75,"dds":0.5263157894736843,"last_synced_commit":"b205e81e9f0a24e758f8d962db9c42748171b076"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreoav%2Fclick-outside-hook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreoav%2Fclick-outside-hook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreoav%2Fclick-outside-hook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreoav%2Fclick-outside-hook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreoav","download_url":"https://codeload.github.com/andreoav/click-outside-hook/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223580036,"owners_count":17168554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["click-outside","hooks","react","typescript"],"created_at":"2024-11-07T19:44:09.140Z","updated_at":"2024-11-07T19:44:10.702Z","avatar_url":"https://github.com/andreoav.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# click-outside-hook\n\nA simple react hook to detect click or touch events outside an element and execute a provided callback when this happens.\n\n[![NPM](https://img.shields.io/npm/v/click-outside-hook.svg)](https://www.npmjs.com/package/click-outside-hook)\n[![CircleCI](https://circleci.com/gh/andreoav/click-outside-hook/tree/master.svg?style=svg)](https://circleci.com/gh/andreoav/click-outside-hook/tree/master) [![Greenkeeper badge](https://badges.greenkeeper.io/andreoav/click-outside-hook.svg)](https://greenkeeper.io/)\n[![module formats: cjs, and es][module-formats-badge]][unpkg-dist]\n\n## Install\n\n```bash\nyarn add click-outside-hook\n```\n\n## Usage\n\n```js\nimport React from 'react';\nimport useClickOutside from 'click-outside-hook';\n\nexport default function SomeAwesomeComponent() {\n  const ref = useClickOutside(() =\u003e console.log('my callback'));\n\n  return (\n    \u003cdiv\u003e\n      \u003cdiv ref={ref}\u003eAwesome content\u003c/div\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\nWhen the user clicks or touches outside the `Awesome content` element, the callback is executed.\n\n## License\n\nMIT © [andreoav](https://github.com/andreoav)\n\n[unpkg-dist]: https://unpkg.com/click-outside-hook/dist\n[module-formats-badge]: https://img.shields.io/badge/module%20formats-cjs%2C%20es-green.svg?style=flat-square\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreoav%2Fclick-outside-hook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreoav%2Fclick-outside-hook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreoav%2Fclick-outside-hook/lists"}