keyboard-shortcut-manager - Vaadin Add-on Directory
A modern library for managing keyboard shortcuts in a Vaadin application.
Note! For the latest version numbers, check https://www.npmjs.com/package/@vaadin-component-factory/keyboard-shortcut-manager
# VCF Keyboard Shortcut Manager
[![npm version](https://badgen.net/npm/v/@vaadin-component-factory/keyboard-shortcut-manager)](https://www.npmjs.com/package/@vaadin-component-factory/keyboard-shortcut-manager) [![Published on Vaadin Directory](https://img.shields.io/badge/Vaadin%20Directory-published-00b4f0.svg)](https://vaadin.com/directory/component/vaadin-component-factorykeyboard-shortcut-manager)
A modern library for managing keyboard shortcuts in a [Vaadin](https://vaadin.com) application (or any framework).
- Dispatch custom events from keyboard shortcuts.
- Bind multiple keyboard commands to a single event listener.
- Easily create simple keyboard shortcut help dialog/popup.
- Compatible with web components and [Shadow DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM).
- Implemented in [TypeScript](https://www.typescriptlang.org/).
This is a wrapper for the [Tinykeys](https://github.com/jamiebuilds/tinykeys) library.
[DEMO ↗](https://keyboard-shortcut-manager.netlify.app/demo/index.html)
[API ↗](https://keyboard-shortcut-manager.netlify.app)
## Install
```sh
npm i @vaadin-component-factory/vcf-keyboard-chortcut-manager
```
## Usage
Create an array of `KeyboardShortcut` definitions:
```ts
const shortcuts: KeyboardShortcut = [
{
keyBinding: 'Control+Shift+?',
handler: 'help-dialog',
description: 'Opens the help dialog.'
}
];
```
Then create a `KeyboardShortcutManager` instance and `subscribe` your shortcuts to activate them:
```ts
const ksm = new KeyboardShortcutManager({ shortcuts, helpDialog: true });
ksm.subscribe();
```
## Keybinding Syntax
Refer to the following links for more information on the keybinding syntax:
- [Keys and Codes](https://github.com/jamiebuilds/tinykeys#commonly-used-keys-and-codes)
- [Keybinding Syntax](https://github.com/jamiebuilds/tinykeys#keybinding-syntax)
## License
Apache-2.0 License
View on GitHub
View on NPM
keyboard-shortcut-manager version 1.0.1
### Dependencies
* @vaadin-component-factory/vcf-enhanced-dialog#22.0.6
* @vaadin/grid#^22.0.4
* tinykeys#^1.4.0
keyboard-shortcut-manager version 1.0.2
### Dependencies
* @vaadin-component-factory/vcf-enhanced-dialog#22.0.6
* @vaadin/grid#^22.0.4
* tinykeys#^1.4.0
keyboard-shortcut-manager version 1.0.3
### Dependencies
* @vaadin-component-factory/vcf-enhanced-dialog#22.0.6
* @vaadin/grid#^22.0.4
* tinykeys#^1.4.0
keyboard-shortcut-manager version 1.0.4
### Dependencies
* @vaadin-component-factory/vcf-enhanced-dialog#22.0.6
* @vaadin/grid#^22.0.4
* tinykeys#^1.4.0
keyboard-shortcut-manager version 1.0.5
### Dependencies
* @vaadin-component-factory/vcf-enhanced-dialog#22.0.6
* @vaadin/grid#^22.0.4
* tinykeys#^1.4.0
keyboard-shortcut-manager version 1.0.6
### Dependencies
* @vaadin-component-factory/vcf-enhanced-dialog#22.0.6
* @vaadin/grid#^22.0.4
* tinykeys#^1.4.0
keyboard-shortcut-manager version 1.0.7
### Dependencies
* @vaadin-component-factory/vcf-enhanced-dialog#22.0.6
* @vaadin/grid#^22.0.4
* tinykeys#^1.4.0
keyboard-shortcut-manager version 1.0.7-legacy-1
### Dependencies
* @vaadin-component-factory/vcf-enhanced-dialog#1.0.10
* @vaadin/vaadin-grid#5.9.2
* lit-html#^2.2.0
* tinykeys#^1.4.0
keyboard-shortcut-manager version 23.0.0
### Dependencies
* @vaadin-component-factory/vcf-enhanced-dialog#23.0.0
* @vaadin/grid#23.0.10
* query-selector-shadow-dom#^1.0.0
* tinykeys#^1.4.0