@vueuse/gesture

๐Ÿ•น Vue Composables making your app interactive
1,771,687 403
Install
npm install @vueuse/gesture
Latest Version:2.0.0
Vue:2 ยท 3
License:MIT
Last Updated:Feb 22, 2024
Links: GitHub  ·  npm
Maintainer: vueuse-bot

๐Ÿ•น @vueuse/gesture

npm npm Netlify Status

Vue Composables making your app interactive

  • ๐Ÿš€ Plug & play
  • ๐Ÿ•น Mouse & Touch support
  • ๐ŸŽฎ Directives support (v-drag, v-pinch, v-move...)
  • โœจ Written in TypeScript
  • โœ… Supports Vue 2 & 3 using vue-demi
  • ๐Ÿคน Plays well with vueuse/motion or any other animation solution

๐ŸŒ Documentation

๐Ÿ‘€ Demos

Quick Start

Let's get started quickly by installing the package and adding the plugin.

From your terminal:

pnpm add @vueuse/gesture

In your Vue app entry file:

import { createApp } from 'vue'
import { GesturePlugin } from '@vueuse/gesture'
import App from './App.vue'

const app = createApp(App)

app.use(GesturePlugin)

app.mount('#app')

You can now interact with any of your component, HTML or SVG elements using v-drag or any other directive.

<template>
  <div v-drag="dragHandler" />
</template>

<script lang="ts">
const dragHandler = (dragState) => {
  // Do something with dragState
}
</script>

To see more about the gestures events data, check out Gesture State.

To see more about the gestures options, check out Gesture Options.

Also, here is a list of the available gestures:

Credits

This package is a fork react-use-gesture by pmndrs.

If you like this package, consider following me on GitHub and on Twitter.

๐Ÿ‘‹

Related Packages

@vueuse/motion

๐Ÿคน Vue Composables putting your components in motion

6,373,564 2,768
vueuse-motion-nightly

๐Ÿคน Vue Composables putting your components in motion

2,072 2,768
zq-vue-hook

easy create form page

313 1
@oku-ui/motion

A tiny, performant animation library for VueJS

64,835 247
vue-recognizer

Vue.js plugin to recognize touch, mouse, pointer events using hammerjs

4,675 11

Version History

Version Released Vue License
2.0.0 ^2.0.0 || >=3.0.0-rc.0 MIT
1.0.0 ^2.0.0 || >=3.0.0-rc.0 MIT
Pre-releases (1)
Version Released Vue License
2.0.0-beta.1 ^2.0.0 || >=3.0.0-rc.0 MIT