Gathering detailed insights and metrics for react-hot-keys
Gathering detailed insights and metrics for react-hot-keys
Gathering detailed insights and metrics for react-hot-keys
Gathering detailed insights and metrics for react-hot-keys
@seesaw/react-hot-keys
React component to listen to keydown and keyup keyboard events, defining and dispatching keyboard shortcuts.
react-hotkeys
A declarative library for handling hotkeys and focus within a React application
webpack-hot-middleware
Webpack hot reloading you can attach to your own server
react-hot-loader
Tweak React components in real time.
npm install react-hot-keys
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
415 Stars
192 Commits
22 Forks
5 Watching
5 Branches
6 Contributors
Updated on 29 Oct 2024
Minified
Minified + Gzipped
TypeScript (88.28%)
Less (7.94%)
HTML (3.78%)
Cumulative downloads
Total Downloads
Last day
0.5%
3,535
Compared to previous day
Last week
-2.5%
18,182
Compared to previous week
Last month
5.2%
80,292
Compared to previous month
Last year
4.7%
825,421
Compared to previous year
2
3
20
React component to listen to keydown and keyup keyboard events, defining and dispatching keyboard shortcuts. Uses a fork of hotkeys.js for keydown detection of special characters. You give it a keymap of shortcuts & it bind it to the mousetrap singleton. The, it'll unbind it when the component unmounts.
react-hotkeys-hook - React hook for using keyboard shortcuts in components. Make sure that you have at least version 16.8 of react and react-dom installed, or otherwise hooks won't work for you.
1npm i -S react-hot-keys
Preview demo.
1import React from 'react'; 2import Hotkeys from 'react-hot-keys'; 3 4export default class HotkeysDemo extends React.Component { 5 constructor(props) { 6 super(props); 7 this.state = { 8 output: 'Hello, I am a component that listens to keydown and keyup of a', 9 } 10 } 11 onKeyUp(keyName, e, handle) { 12 console.log("test:onKeyUp", e, handle) 13 this.setState({ 14 output: `onKeyUp ${keyName}`, 15 }); 16 } 17 onKeyDown(keyName, e, handle) { 18 console.log("test:onKeyDown", keyName, e, handle) 19 this.setState({ 20 output: `onKeyDown ${keyName}`, 21 }); 22 } 23 render() { 24 return ( 25 <Hotkeys 26 keyName="shift+a,alt+s" 27 onKeyDown={this.onKeyDown.bind(this)} 28 onKeyUp={this.onKeyUp.bind(this)} 29 > 30 <div style={{ padding: "50px" }}> 31 {this.state.output} 32 </div> 33 </Hotkeys> 34 ) 35 } 36}
Supported keys ⇧
, shift
, option
, ⌥
, alt
, ctrl
, control
, command
, ⌘
.
⌘
Command()
⌃
Control
⌥
Option(alt)
⇧
Shift
⇪
Caps Lock
fn
Function key is fn
(not supported)
↩︎
return/enter
space
space keys
Callback function to be called when user pressed the target buttons
space
space keys
Callback function to be called when user key uped the target buttons
allowRepeat?: boolean;
allowRepeat
to allow auto repeating key down
disabled?: boolean;
Disable onKeyDown
and onKeyUp
events. Default: undefined
INPUT
SELECT
TEXTAREA
default does not handle. filter
to return to the true shortcut keys set to play a role, flase shortcut keys set up failure.
1 <Hotkeys 2 keyName="shift+a,alt+s" 3+ filter={(event) => { 4+ return true; 5+ }} 6 onKeyDown={this.onKeyDown.bind(this)} 7 onKeyUp={this.onKeyUp.bind(this)} 8 />
As always, thanks to our amazing contributors!
Made with action-contributors.
Licensed under the MIT License.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
packaging workflow detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
Found 0/20 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More