# v-hotkey
**Repository Path**: mirrors_dafrok/v-hotkey
## Basic Information
- **Project Name**: v-hotkey
- **Description**: Vue 2.x directive for binding hotkeys to components.
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-08-08
- **Last Updated**: 2026-05-23
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# v-hotkey
[](https://bundlephobia.com/result?p=v-hotkey)
[](https://npm.im/v-hotkey)
[](https://github.com/dafrok/v-hotkey/blob/master/LICENSE)
[](https://standardjs.com)
Vue 2.x directive for binding hotkeys to components.
## Play with me
[https://dafrok.github.io/v-hotkey](https://dafrok.github.io/v-hotkey)
## Install
```bash
$ npm i v-hotkey
# or
$ yarn add v-hotkey
```
## Usage
```javascript
import Vue from 'vue'
import VueHotkey from 'v-hotkey'
Vue.use(VueHotkey)
```
```vue
Press `ctrl + esc` to toggle me! Hold `enter` to hide me!
```
## Event Handler
- keydown (as default)
- keyup
## Key Combination
Use one or more of following keys to fire your hotkeys.
- ctrl
- alt
- shift
- command (MacOS)
- windows (Windows)
## Modifiers
### prevent
Add the prevent modifier to the directive to prevent default browser behavior.
```vue
Press `ctrl + esc` to toggle me! Hold `enter` to hide me!
```
### stop
Add the stop modifier to the directive to stop event propagation.
```vue
Enter characters in editable areas doesn't trigger any hotkeys.
```
## Key Code Alias
The default key code map is based on US standard keyboard.
This ability to provide their own key code alias for developers who using keyboards with different layouts. The alias name must be a **single character**.
### Definition
```javascript
import Vue from 'vue'
import VueHotkey from 'v-hotkey'
Vue.use(VueHotkey, {
'①': 49 // the key code of character '1'
})
```
### Template
```vue
```