multi Keypress detection handlers for React.js
React wrapper for Keypress.js - http://dmauro.github.io/Keypress
Keypress is an input capture library which can be used to capture combination of keys in a simple way.
$ npm install react-keypress
or
$ bower install react-keypress
Lets say that you want to fire a function when the user press shift + enter + a
:
var React = require("react");
var Keypress = require("react-keypress");
React.createClass({
sayHello() {
alert("hello!");
},
render() {
<div>
<input type="text" onKeyPress={Keypress("shift enter a", this.sayHello)}/>
</div>
}
});
Type: String
This option can be either an array of strings, or a single space separated string of key names that describe the keys that make up the combo.
Type: Function
This is a function that gets called everytime the keypress event for our combo is fired.
- backspace
- tab
- num
- enter
- shift
- ctrl
- alt
- pause
- caps
- esc
- space
- pageup
- pagedown
- end
- home
- left
- up
- right
- down
- insert
- delete
- cmd
Hector Leon Zarco Garcia - @zzarcon