react-keyboard-visualizer
v1.0.1
Published
A keyboard visualizer for React
Maintainers
Readme
React Keyboard Visualizer
A keyboard visualizer for React. Demo

Features
- Minimalistic and beautiful keyboard
- Easily adjust style and size
- Zero dependencies
- Supports React 18+
Usage
import { KeyboardVisualizer } from 'react-keyboard-visualizer'
function App() {
return (
<div>
<KeyboardVisualizer
listenToKeyboard={true}
/>
</div>
)
}
export default AppAPI
KeyboardVisualizer component props:
pressedKeys?: Set<string>externally controlled set of pressed key codes. If provided, the component becomes controlled for key state.onKeyPress?: (key: string) => voidcallback invoked when a key is pressed. Receives theKeyboardEvent.codeorKeyboardEvent.keyfallback used by the component.onKeyRelease?: (key: string) => voidcallback invoked when a key is released.keySize?: numbersize (in pixels) of a single key. Default:40.gap?: numbergap (in pixels) between keys. Default:3.style?: React.CSSPropertiesadditional inline styles applied to the keyboard container.className?: stringadditional class name applied to the keyboard container.listenToKeyboard?: booleanwhether the component listens to window keyboard events. Default:true.
License
This library is licensed under the MIT License.
