use-short-key
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i use-short-key

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

35.9 kB

Total Files

11

Last publish

Collaborators

  • dancerphil