GithubHelp home page GithubHelp logo

react-keypress's Introduction

keypress-react

React wrapper for Keypress.js

This library is a react wrapper around the excellent Keypress.js https://dmauro.github.io/Keypress/.

NPM JavaScript Style Guide

Install

npm install --save keypress-react

Usage

This library has 3 public components.

  1. KeyboardShortcutsProvider is the Context Provider Component

      import { 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.

  2. KeyboardShortcut is the Shortcut Component

    import { KeyboardShortcut } from 'keypress-react'
    

    This component take the props combo along with the callback and the description.

    <KeyboardShortcuts combo="shift a" callback={callback} description="Example Shortcut" />
    
  3. withKeyboardShortcuts is the HOC Component

    import { withKeyboardShortcuts } from 'keypress-react'
    

    This is a higher order components. This will inject a prop keyboardShortcuts into 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)

react-keypress's People

Contributors

gnsharma avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.