0.0.3 • Published 1 year ago

use-short-key v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

use-short-key

version npm downloads codecov MIT License

use-short-key helps register short keys for your application. It has almost same API as KeyboardEvent.

English | 中文

Get Started

  • install
npm i use-short-key
  • register a short key
const Component = () => {
    // register on `⌘C`
    useShortKey({
        metaKey: true,
        code: 'KeyC',
        keydown: (e: KeyboardEvent) => {
            // ...
        },
    });
    
    // ...
};

Example

Online Example