Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcushellberg/shortcut
Easy keyboard shortcuts in Vaadin Flow
https://github.com/marcushellberg/shortcut
Last synced: about 2 months ago
JSON representation
Easy keyboard shortcuts in Vaadin Flow
- Host: GitHub
- URL: https://github.com/marcushellberg/shortcut
- Owner: marcushellberg
- License: apache-2.0
- Created: 2018-05-29T00:57:53.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-18T13:27:44.000Z (over 6 years ago)
- Last Synced: 2024-11-09T06:14:06.506Z (3 months ago)
- Language: Java
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Keyboard shortcut listener for [Vaadin Flow](https://vaadin.com/flow)
A simple helper for making it easier to add keyboard shortcuts to your Vaadin Flow applications.
## Event scoping
The component or element you pass in works as the scope for the event. This means that the event can come from either the component itself or any of it's children.
## Simple usage
Often all that is needed is mapping a key to an action.
```java
var messageField = new TextField();
Shortcut.add(messageField, Key.ENTER, sendButton::click);
```## Modifier keys
You can also add modifier keys to the shortcuts. For example, submit on Shift+Enter:
```java
var messageField = new TextField();
Shortcut.add(messageField, Key.ENTER, sendButton::click, Key.SHIFT);
```