1.0.0 • Published 3 years ago

@missspopcorn/keyboard-shortcut v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

Keyboard Shortcuts

A library to bind keyboard shortcuts in your React App.

  • Take Key combination as input
  • Suppports callback for the key shortcut you like

tl;dr

  • Install by executing npm install keyboard-shortcuts.
  • Import by adding import { KeyboardShortcuts } from "keyboard-shortcuts'.
  • Use by adding <KeyboardShortcuts />.

Demo

A minimal demo can be found in components directory and App.js.

Online demo is also available!

Getting started

Compatibility

Your project needs to use React 16.8 or later.

keyboard-shortcuts uses modern web technologies. That's why it's so fast, and lightweight.

Installation

Add React-Calendar to your project by executing npm install keyboard-shortcuts

Usage

Here's an example of basic usage:

import { KeyboardShortcuts } from "keyboard-shortcuts";

function MyApp() {
  const [value, onChange] = useState(new Date());

  return (
    <div>
       <KeyboardShortcuts
        combo="shift b"
        callback={() => function()}
        description="The shortcut description"
      ></KeyboardShortcuts>
    </div>
  );
}

To list all keyboard shortcuts passed to the components:

import { withKeyboardShortcuts } from 'keyboard-shortcuts'


 function Component({
   keyboardShortcuts
 }) {
 }
 withKeyboardShortcut(Component)

License

The MIT License.

Author

Thank you