{"id":23058658,"url":"https://github.com/suhdev/typescript-react-draggable","last_synced_at":"2025-04-03T06:18:39.087Z","repository":{"id":57383917,"uuid":"64782037","full_name":"suhdev/typescript-react-draggable","owner":"suhdev","description":"An HTML and SVG draggable components for react written in TypeScript. ","archived":false,"fork":false,"pushed_at":"2016-12-26T23:20:50.000Z","size":49,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-11T23:36:54.541Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/suhdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-02T18:27:57.000Z","updated_at":"2021-08-04T12:38:50.000Z","dependencies_parsed_at":"2022-09-14T00:52:43.828Z","dependency_job_id":null,"html_url":"https://github.com/suhdev/typescript-react-draggable","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2Ftypescript-react-draggable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2Ftypescript-react-draggable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2Ftypescript-react-draggable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2Ftypescript-react-draggable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suhdev","download_url":"https://codeload.github.com/suhdev/typescript-react-draggable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246944383,"owners_count":20858772,"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":[],"created_at":"2024-12-16T02:16:54.628Z","updated_at":"2025-04-03T06:18:39.079Z","avatar_url":"https://github.com/suhdev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# typescript-react-draggable \n\nA library that provides Draggable and Zoomable React components written in TypeScript:\n1. Draggable: adds drag behavior to its child component given that the child component is an HTMLElement with arbitrary content.  \n2. SVGDraggable: adds drag behavior to its child component given that the given component is an SVG component. \n3. Zoomable: adds zoom behavior to HTML components.  \n4. SVGZoomable: adds zoom behavior to SVG components. \n\n\n## Dependences\nD3: this library uses d3.behavior.drag, and d3.behavior.zoom to add the behavior to react components. \n\n## Example\n\n```javascript\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom'; \nimport {Draggable} from 'typescript-react-draggable';\n\nReactDOM.render(\n    \u003cDraggable\u003e\n        \u003cdiv className=\"draggable-element\"\u003eDrag Me\u003c/div\u003e\n    \u003c/Draggable\u003e\n,document.getElementById('TestCanvas')); \n\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom'; \nimport {SVGDraggable} from 'typescript-react-draggable';\n\nReactDOM.render(\n    \u003cSVGDraggable\u003e\n        \u003ccircle className=\"draggable-element\" /\u003e\n    \u003c/SVGDraggable\u003e,document.getElementById('SVGCanvas')); \n\n//Zoomable \nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom'; \nimport {Zoomable} from 'typescript-react-draggable';\n\nReactDOM.render(\n    \u003cZoomable\u003e\n        \u003cdiv className=\"element-1\"\u003eButton\u003c/div\u003e\n        \u003cdiv className=\"element-2\"\u003eSomething else\u003c/div\u003e\n    \u003c/Zoomable\u003e\n,document.getElementById('TestCanvas')); \n\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom'; \nimport {SVGZoomable} from 'typescript-react-draggable';\n\nReactDOM.render(\n    \u003cSVGZoomable\u003e\n        \u003ccircle className=\"element el-1\" /\u003e\n        \u003ccircle className=\"element el-2\" /\u003e\n    \u003c/SVGZoomable\u003e,document.getElementById('SVGCanvas')); \n\n\n```\n\n\n## Notes\nBoth Draggable and SVGDraggable do not add extra HTML/SVG elements to the DOM, but rather apply the drag behavior to the wrapped child element. \n\n\n### Future work\n* Allow Draggable component to accept multiple top-level children such that all children receive the behavior.\n\n\n\n\nSuhail Abood \u0026copy; 2016  ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuhdev%2Ftypescript-react-draggable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuhdev%2Ftypescript-react-draggable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuhdev%2Ftypescript-react-draggable/lists"}