vue-use-hotkeys
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

vue-use-hotkeys

Vue composition for using keyboard shortcuts in components. This is a hook version for hotkeys package.

Install

via pnpm, yarn or npm:

$ pnpm add vue-use-hotkeys
# or
$ yarn add vue-use-hotkeys
# or
$ npm i -S vue-use-hotkeys

Usage

import { defineComponent, ref } from 'vue'
import { useHotkeys } from 'vue-use-hotkeys'

export default defineComponent(() => {
  const count = ref(0)

  useHotKeys('ctrl + k', () => {
    count.value += 1
  })

  return () => (
    <p>
      Pressed <kbd>ctrl + k</kbd> {count.value} times.
    </p>
  )
})

Preview demo:

To-Do(s)

  • [x] add support of @vue/composition-api;

License

MIT © Mitscherlich

Readme

Keywords

none

Package Sidebar

Install

npm i vue-use-hotkeys

Weekly Downloads

33

Version

0.4.0

License

MIT

Unpacked Size

13.1 kB

Total Files

9

Last publish

Collaborators

  • mitscherlich36