{"id":16910213,"url":"https://github.com/idanen/react-draggable","last_synced_at":"2025-03-22T10:31:46.462Z","repository":{"id":35102609,"uuid":"206635210","full_name":"idanen/react-draggable","owner":"idanen","description":"A custom hook to make elements draggable","archived":false,"fork":false,"pushed_at":"2023-05-04T20:55:39.000Z","size":1326,"stargazers_count":12,"open_issues_count":9,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T10:38:00.414Z","etag":null,"topics":["custom-hook","draggable","react"],"latest_commit_sha":null,"homepage":null,"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/idanen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-09-05T18:50:42.000Z","updated_at":"2024-03-27T21:45:04.000Z","dependencies_parsed_at":"2024-06-19T09:17:02.325Z","dependency_job_id":"1100a20e-b738-4548-ad98-da378b6b0e48","html_url":"https://github.com/idanen/react-draggable","commit_stats":{"total_commits":91,"total_committers":4,"mean_commits":22.75,"dds":0.5714285714285714,"last_synced_commit":"ee92de0443a9fee470a444b83f292803e9ff5f7a"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idanen%2Freact-draggable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idanen%2Freact-draggable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idanen%2Freact-draggable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idanen%2Freact-draggable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idanen","download_url":"https://codeload.github.com/idanen/react-draggable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244943914,"owners_count":20536290,"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":["custom-hook","draggable","react"],"created_at":"2024-10-13T18:59:49.305Z","updated_at":"2025-03-22T10:31:46.140Z","avatar_url":"https://github.com/idanen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-draggable\n\n[![Travis (.org)](https://img.shields.io/travis/idanen/react-draggable)](https://travis-ci.org/idanen/react-draggable)\n[![npm](https://img.shields.io/npm/v/use-draggable)](https://www.npmjs.com/package/use-draggable?activeTab=versions)\n[![npm](https://img.shields.io/npm/dm/use-draggable)](https://www.npmjs.com/package/use-draggable)\n[![GitHub](https://img.shields.io/github/license/idanen/react-draggable)](https://github.com/idanen/react-draggable/blob/master/LICENSE)\n\nA custom hook to make elements draggable.\n\n## Usage\n\n### Simplest usage:\n\n```javascript\nimport { useDraggable } from 'use-draggable';\n\nfunction MyComponent(props) {\n  const { targetRef } = useDraggable({ controlStyle: true });\n\n  return (\n    \u003cdiv ref={targetRef}\u003e\n      \u003ch1\u003eYou can drag me :)\u003c/h1\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\n### Usage in a class component:\n\n```javascript\nimport React from 'react';\nimport { Draggable } from 'use-draggable';\n\nclass MyComponent extends React.Component {\n  render() {\n    return (\n      \u003cDraggable\u003e\n        {({ targetRef, handleRef }) =\u003e (\n          \u003cdiv ref={targetRef}\u003e\n            \u003ch1\u003eYou can drag me :)\u003c/h1\u003e\n            \u003cbutton ref={handleRef}\u003ewith this handle\u003c/button\u003e\n          \u003c/div\u003e\n        )}\n      \u003c/Draggable\u003e\n    );\n  }\n}\n```\n\n## Live demo\n\nhttps://codesandbox.io/s/use-draggable-demo-tiu3w\n\n## Contribute\nPRs are welcomed!\nNote - when opening a PR, make sure the last commit message abides [commitizen guidelines](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidanen%2Freact-draggable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidanen%2Freact-draggable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidanen%2Freact-draggable/lists"}