react-combo-keys
v2.1.0
Published
React component to bind keyboard shortcuts
Downloads
6
Readme
react-combo-keys
Declarative API with React to bind keyboard shortcuts using Mousetrap.
Installation
$ yarn add react-combo-keys
Usage
import * as React from 'react';
import { useComboKeys } from 'react-combo-keys';
function SearchBar(props: {}) {
const input = Rwact.useRef();
useComboKeys({
'Mod+F': () => {
input.current.focus();
},
'Mod+': () => {
alert('Settings !')
}
}, {}, []);
return <input type="text" ref={input} />;
}