Hotkey
Vue Bootstrap 5 Hotkey
The mdbHotkey
is a custom directive which allows to set callbacks for key combinations.
Note: Read the API tab to find all available options and advanced customization
Basic example
Import the directive from 'mdb-vue-ui-kit' and add mdbHotkey
to the directives object. Attach the directive to the element on which you wish to listen for events and pass a keymap as the value.
Press alt+l to insert a default text / ctrl + c to clear textarea
Hotkey - API
Import
Modifiers
Name | Description | Example |
---|---|---|
:window |
Adds the event listener to the window instead of the element. |
<div v-mdb-hotkey:window="keymap"></div>
|
:document |
Adds the event listener to the document instead of the element. |
<div v-mdb-hotkey:document="keymap"></div>
|
Options
Name | Description | Example |
---|---|---|
.stop |
Calls stopPropagation method on the keydown event |
<div v-mdb-hotkey.stop="keymap"></div>
|
.prevent |
Calls preventDefault method on the keydown event |
<div v-mdb-hotkey.prevent="keymap"></div>
|