Simple-Keyboard is a robust, lightweight, and highly customizable JavaScript virtual keyboard library designed for web applications. Currently at version 3.8.133, it maintains a stable release cadence with frequent updates addressing bugs and adding features. Key differentiators include broad browser compatibility (down to IE11 with specific bundles), built-in TypeScript support since v3.0.0, and a modular architecture allowing extensions for autocorrect, input masks, and key navigation. It is designed to be framework-agnostic, easily integrating into vanilla JavaScript, React, Angular, and Vue projects, providing an on-screen input solution suitable for touchscreens, kiosks, and general web input fields.
npm install simple-keyboardVerified import paths — ran on the pinned version, not inferred.
Initializes simple-keyboard with a custom layout, demonstrating how to handle input changes, key presses, and dynamically switch between 'default', 'shift', and 'numbers' layouts.
Review and adjust your CSS rules targeting `layoutCandidates` if their appearance changed unexpectedly after upgrading.
If you need backspace functionality, ensure your layout uses the `{backspace}` button. For forward delete, `{delete}` is now standard.Update any custom modules to adhere to the new function-based structure, directly accepting the `keyboard` instance. Consult the official documentation for updated module creation guidelines.
For modern applications, prefer `import SimpleKeyboard from 'simple-keyboard';`. For Node.js CommonJS environments, `const SimpleKeyboard = require('simple-keyboard');` should work. Ensure your build tooling (e.g., Webpack, Rollup) is configured for proper dual ESM/CJS package resolution.Verify your TypeScript configuration, particularly `typeRoots` or `paths` settings, if you encounter type resolution errors after upgrading to v3.4.0 or later.
For IE11 compatibility, explicitly target `simple-keyboard/build/index.js` in your `<script>` tag or bundler configuration, rather than `index.modern.js` or ESM builds.
Ensure you are using a default import: `import SimpleKeyboard from 'simple-keyboard';`. For CommonJS, `const SimpleKeyboard = require('simple-keyboard');` should correctly resolve the default export.Ensure `simple-keyboard` initialization code is executed only in a client-side (browser) environment. For SSR applications, use dynamic imports with a `typeof window !== 'undefined'` check or a dedicated SSR solution to defer client-side code.
Add a type assertion to `HTMLInputElement` and ensure the element exists before passing it: `document.querySelector('.input') as HTMLInputElement;` then check if `inputElement` is not `null` before passing, or pass the CSS selector string directly to `input`.No dependency data recorded yet.