React support for @reasonink/clack
npm install @reasonink/clack-reactThis package provides two React components that enable keyboard shortcuts in
React.
Install with npm install @reasonink/clack-react or, if using yarnyarn add @reasonink/clack-react.
Older versions of npm require the --save flag in order to add the
package to dependencies in your package.json.
In the following example we create a component MyComponent that wrapsMyOtherComponent with three keyboard shortcuts. Whenever MyOtherComponent
or any of its children are focused the three shortcuts will be enabled.
``tsx
import { Keyboard, KeyCombo } from "@reasonink/clack-react";
function MyComponent(props: {}) {
return
}
`
Two components are provided. Keyboard is a wrapper for one or moreKeyCombo elements and a single other element that is the target of the
keyboard shortcuts.
Renders a
containing the single non-KeyCombo` child.Specifies a keyboard shortcut. The following props are supported:
<Keyboard> is not focused.e.preventDefault() isThis library is made available under the MIT license. See the LICENSE file for
details.