keypress-react v1.0.0
keypress-react
React wrapper for Keypress.js
This library is a react wrapper around the excellent Keypress.js https://dmauro.github.io/Keypress/.
Install
npm install --save keypress-reactUsage
This library has 3 public components.
KeyboardShortcutsProvideris the Context Provider Componentimport { KeyboardShortcutsProvider } from 'keypress-react'This should be at the top of the component tree for which you want to enable shortcuts. It passes the keyboard shortcut context down to your app. All the keyboard shortcut are store in this context.
KeyboardShortcutis the Shortcut Componentimport { KeyboardShortcut } from 'keypress-react'
This component take the props
comboalong with thecallbackand thedescription.withKeyboardShortcutsis the HOC Componentimport { withKeyboardShortcuts } from 'keypress-react'
This is a higher order components. This will inject a prop
keyboardShortcutsinto the provided component. This props contains all the keyboard shortcuts. It is an array of objects with value and description keys.withKeyboardShortcuts(Component)
License
MIT © Govind N Sharma(https://github.com/Govind N Sharma)
5 years ago