{"id":13450905,"url":"https://github.com/sbaidon/useDropZone","last_synced_at":"2025-03-23T16:32:37.839Z","repository":{"id":38173283,"uuid":"272260351","full_name":"sbaidon/useDropZone","owner":"sbaidon","description":"Custom react hook that handles drop file logic","archived":false,"fork":false,"pushed_at":"2023-07-19T17:10:33.000Z","size":2755,"stargazers_count":4,"open_issues_count":10,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-31T07:15:52.337Z","etag":null,"topics":["hooks","react"],"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/sbaidon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"code-of-conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"https://www.paypal.me/sbaidon"}},"created_at":"2020-06-14T18:27:59.000Z","updated_at":"2023-09-12T01:05:52.000Z","dependencies_parsed_at":"2024-01-07T18:23:45.663Z","dependency_job_id":null,"html_url":"https://github.com/sbaidon/useDropZone","commit_stats":{"total_commits":7,"total_committers":3,"mean_commits":"2.3333333333333335","dds":0.2857142857142857,"last_synced_commit":"0d9849f16c0bd3599eecbc55d77c5c094eb9a0b8"},"previous_names":[],"tags_count":1,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbaidon%2FuseDropZone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbaidon%2FuseDropZone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbaidon%2FuseDropZone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbaidon%2FuseDropZone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sbaidon","download_url":"https://codeload.github.com/sbaidon/useDropZone/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221856520,"owners_count":16892456,"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":["hooks","react"],"created_at":"2024-07-31T07:00:40.052Z","updated_at":"2024-10-28T16:32:09.378Z","avatar_url":"https://github.com/sbaidon.png","language":"TypeScript","funding_links":["https://www.paypal.me/sbaidon"],"categories":["Packages"],"sub_categories":[],"readme":"# useDropZone\n\n[![Build Status](https://travis-ci.org/sbaidon/useDropZone.svg?branch=master)](https://travis-ci.org/sbaidon/useDropZone)\n\nSimple custom react hook that handles the logic to drop a file over a defined drop zone\n\n# Install\n\n`npm install use-drop-zone --save`\n\n# How to use\n\nYou only need to provide an `onDrop` function which will be called with the _files_ that were dropped over the drop zone. If no files are detected your function will be called with _null_.\n\nThe custom hook returns two things, a boolean flag which indicates if an item is _over_ the drop zone, as well as all the _event handlers_ needed to make your drop zone work properly, you _must_ attach the handlers on an item for the hook to work properly.\n\n## Example\n\n```javascript\nfunction Component() {\n  function onDrop(files) {\n    // Do whatever you need with files!\n    console.log(files)\n  }\n\n  const [isOver, handlers] = useDropZone(onDrop)\n\n  return (\n    \u003cdiv {...handlers}\u003e\n      \u003cp\u003eA\u003c/p\u003e\n      \u003cp\u003eB\u003c/p\u003e\n      \u003cp\u003eC\u003c/p\u003e\n    \u003c/div\u003e\n  )\n}\n```\n\n# Gotchas\n\nThis custom hook takes care of the `dragLeave` event firing on child elements of your dropzone (see [this](https://stackoverflow.com/questions/7110353/html5-dragleave-fired-when-hovering-a-child-element) fore more info), if you are looking for different behavior feel free to fork this repository and implement your own custom behavior.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbaidon%2FuseDropZone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbaidon%2FuseDropZone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbaidon%2FuseDropZone/lists"}