Skip to content

dancerphil/use-short-key

Repository files navigation

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