{"id":13818738,"url":"https://github.com/koca/vue-use-gesture","last_synced_at":"2025-04-09T17:25:00.828Z","repository":{"id":48017027,"uuid":"345765006","full_name":"koca/vue-use-gesture","owner":"koca","description":"👇  Bread n butter utility for component-tied mouse/touch gestures in Vue","archived":false,"fork":false,"pushed_at":"2021-08-11T00:22:41.000Z","size":15967,"stargazers_count":152,"open_issues_count":6,"forks_count":9,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-04-23T18:37:12.255Z","etag":null,"topics":["composable","gesture","hooks","vue"],"latest_commit_sha":null,"homepage":"https://vue-use-gesture.netlify.app","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/koca.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":"2021-03-08T19:05:25.000Z","updated_at":"2024-03-15T00:40:24.000Z","dependencies_parsed_at":"2022-08-12T16:41:17.330Z","dependency_job_id":null,"html_url":"https://github.com/koca/vue-use-gesture","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koca%2Fvue-use-gesture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koca%2Fvue-use-gesture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koca%2Fvue-use-gesture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koca%2Fvue-use-gesture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koca","download_url":"https://codeload.github.com/koca/vue-use-gesture/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248075759,"owners_count":21043645,"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":["composable","gesture","hooks","vue"],"created_at":"2024-08-04T08:00:27.010Z","updated_at":"2025-04-09T17:25:00.802Z","avatar_url":"https://github.com/koca.png","language":"TypeScript","funding_links":[],"categories":["Packages","vue","TypeScript"],"sub_categories":[],"readme":"# Vue UseGesture\n\n\u003c!-- [![Bundle size (minified + gzip)][bundle-size-badge]][bundle-size]\n[![NPM Downloads][downloads-badge]][downloads]\n[![Build Status][build-badge]][build]\n![Codecov][covarage-badge]\n[![Version][version-badge]][package]\n[![MIT License][license-badge]][license] --\u003e\n\n\u003e WIP\n\nVue UseGesture is a hook that lets you bind richer mouse and touch events to any component or view. With the data you receive, it becomes trivial to set up gestures, and often takes no more than a few lines of code.\n\nYou can use it stand-alone, but to make the most of it you should combine it with an animation library like [vue-use-spring](https://github.com/posva/vue-use-spring), though you can most certainly use any other.\n\n\u003cp align=\"middle\"\u003e\n  \u003ca href=\"#\"\u003e\u003cimg src=\"https://i.imgur.com/qLKJod3.gif\" width=\"400\"/\u003e\u003c/a\u003e\n  \u003ca href=\"#\"\u003e\u003cimg src=\"https://i.imgur.com/H6nXQEq.gif\" width=\"400\"/\u003e\u003c/a\u003e\n  \u003ca href=\"#\"\u003e\u003cimg src=\"https://i.imgur.com/THKPrmR.gif\" width=\"400\"/\u003e\u003c/a\u003e\n  \u003ca href=\"#\"\u003e\u003cimg src=\"https://i.imgur.com/cuOfqST.gif\" width=\"400\"/\u003e\u003c/a\u003e\n  \u003ca href=\"#\"\u003e\u003cimg src=\"https://i.imgur.com/iwZOfT9.gif\" width=\"400\"/\u003e\u003c/a\u003e\n  \u003ca href=\"#\"\u003e\u003cimg src=\"https://i.imgur.com/Walt1Ip.gif\" width=\"400\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"middle\"\u003e\u003ci\u003eThe demos are real (we'll add them to the codesandbox soon)\u003c/i\u003e\u003c/p\u003e\n\n### Installation\n\n```bash\n#Yarn\nyarn add vue-use-gesture\n\n#NPM\nnpm install vue-use-gesture\n```\n\n### [Full documentation website](https://vue-use-gesture.netlify.com)\n\n- [Available Hooks](https://vue-use-gesture.netlify.com/docs/hooks)\n- [Gesture State](https://vue-use-gesture.netlify.com/docs/state)\n- [Gesture Options](https://vue-use-gesture.netlify.com/docs/options)\n- [Utilities](https://vue-use-gesture.netlify.com/docs/utilities)\n- [FAQ](https://vue-use-gesture.netlify.com/docs/faq)\n\n### Simple example\n\n\u003cp align=\"middle\"\u003e\n  \u003ca href=\"#\"\u003e\u003cimg src=\"https://i.imgur.com/AMzsEi3.gif\" width=\"400\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n```html\n\u003ctemplate\u003e\n  \u003c!-- Bind it to a component --\u003e\n  \u003cdiv v-bind=\"bind()\" :style=\"style\" class=\"box\"\u003e\u003c/div\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\n  import { useDrag } from 'vue-use-gesture'\n  import { useSpring } from 'vue-use-spring'\n  import { defineComponent, computed } from 'vue'\n\n  export default defineComponent({\n    setup() {\n      const [{ x, y }, set] = useSpring(() =\u003e ({ x: 0, y: 0 }))\n\n      // Set the drag hook and define component movement based on gesture data\n      const bind = useDrag(({ down, movement: [mx, my] }) =\u003e {\n        set({ x: down ? mx : 0, y: down ? my : 0 })\n      })\n\n      const style = computed(() =\u003e ({ transform: `translate3d(${x.value}px,${y.value}px,0)`, touchAction: 'none' }))\n\n      return { bind, style }\n    },\n  })\n\u003c/script\u003e\n```\n\nThe example above makes a `div` draggable so that it follows your mouse on drag, and returns to its initial position on release.\n\n**Make sure you always set [`touchAction`](https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action) on a draggable element to prevent glitches with the browser native scrolling on touch devices**.\n\n### Available hooks\n\n`vue-use-gesture` exports several hooks that can handle different gestures:\n\n| Hook         | Description                                |\n| ------------ | ------------------------------------------ |\n| `useDrag`    | Handles the drag gesture                   |\n| `useMove`    | Handles mouse move events                  |\n| `useHover`   | Handles mouse enter and mouse leave events |\n| `useScroll`  | Handles scroll events                      |\n| `useWheel`   | Handles wheel events                       |\n| `usePinch`   | Handles the pinch gesture                  |\n| `useGesture` | Handles multiple gestures in one hook      |\n\n#### [More on the full documentation website...](https://vue-use-gesture.netlify.com)\n\n## Thanks\n\n\u003e This library is a port of [React UseGesture](https://github.com/pmndrs/react-use-gesture). Thanks [Poimandres](https://twitter.com/pmndrs) 🙏\n\n## License\n\nMIT\n\n[build-badge]: https://img.shields.io/circleci/project/github/koca/vue-use-gesture/master.svg?style=flat-square\n[build]: https://circleci.com/gh/koca/vue-use-gesture\n[downloads-badge]: https://img.shields.io/npm/dt/vue-use-gesture.svg?style=flat-square\n[downloads]: https://npmjs.com/package/vue-use-gesture\n[build-badge]: https://img.shields.io/npm/dm/vue-client-only.svg?style=flat\n[license-badge]: https://img.shields.io/npm/l/vue-use-gesture.svg?style=flat-square\n[license]: https://opensource.org/licenses/MIT\n[version-badge]: https://img.shields.io/npm/v/vue-use-gesture.svg?style=flat-square\n[package]: https://www.npmjs.com/package/vue-use-gesture\n[bundle-size-badge]: https://img.shields.io/bundlephobia/minzip/vue-use-gesture@1.x.x.svg?style=flat-square\n[bundle-size]: https://bundlephobia.com/result?p=vue-use-gesture\n[covarage-badge]: https://img.shields.io/codecov/c/github/koca/vue-use-gesture?style=flat-square\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoca%2Fvue-use-gesture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoca%2Fvue-use-gesture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoca%2Fvue-use-gesture/lists"}