npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mt-react-keyboard

v1.0.6

Published

React typescript customizable keyboard component

Readme

mt-react-keyboard

npm version npm downloads license: MIT

Customizable virtual on-screen keyboard component for React (TypeScript). Supports a standard QWERTY layout with optional key scrambling and full-screen mode.

Features

  • Standard QWERTY layout with optional key scrambling
  • Full-screen or inline display modes
  • Customizable key colors, hover effects, and text styles
  • Integration with input or textarea elements
  • Supports action keys: shift, caps lock, backspace, tab, enter, space
  • Responsive design for mobile and desktop
  • Portal rendering for full-screen mode

Installation

npm install mt-react-keyboard
# or
yarn add mt-react-keyboard
# or
pnpm add mt-react-keyboard

Peer dependencies (ensure these exist in your app):

npm install react react-dom

Usage

Here’s an example of how to use the MTKeyboard component:

import React, { useRef } from "react";
import MTKeyboard from "./MTKeyboard";

const App = () => {
  const inputRef = useRef<HTMLInputElement>(null);

  return (
    <div>
      <input ref={inputRef} type="text" placeholder="Type here" />
      <MTKeyboard
        targetRef={inputRef}
        scramble={true}
        fullScreen={true}
        isVisible={true}
        onClose={() => console.log("Keyboard closed")}
        keysBgColor="#ffffff"
        hoverBgColor="#e0e0e0"
        actionsBgColor="#d3d3d3"
        keysMainTextColor="#000000"
        keysVariantTextColor="#666666"
      />
    </div>
  );
};

export default App;

Props

The MTKeyboard component accepts the following props:

| Prop | Type | Default | Description | |-----------------------|-----------------------------------------|---------------|-----------------------------------------------------------------------------| | scramble | boolean | false | Randomizes the position of printable keys if true. | | fullScreen | boolean | false | Renders the keyboard as a full-screen overlay if true. | | isVisible | boolean | true | Toggles the visibility of the keyboard. | | targetRef | React.RefObject<HTMLInputElement \| HTMLTextAreaElement \| null> | undefined | Ref to the target input or textarea element. If not provided, uses the active element. | | onClose | () => void | undefined | Callback function to handle closing the keyboard (used in full-screen mode). | | keysBgColor | CSSProperties["color"] | #ffffff | Background color for regular keys. | | hoverBgColor | CSSProperties["color"] | #e0e0e0 | Background color for keys on hover. | | actionsBgColor | CSSProperties["color"] | #e0e0e0 | Background color for action keys (e.g., shift, caps). | | keysMainTextColor | CSSProperties["color"] | #010101 | Text color for main key labels. | | keysVariantTextColor| CSSProperties["color"] | inherit | Text color for variant labels (e.g., shift key symbols). |

Key Features Explained

  • Scramble Mode: When scramble is true, printable keys are randomized, while action keys (e.g., shift, enter) remain in place.
  • Full-Screen Mode: When fullScreen is true, the keyboard is rendered at the bottom of the screen using a portal, with a close button.
  • Shift and Caps Lock: Shift toggles temporarily, while caps lock persists for letters only. Both display their respective states visually.
  • Responsive Design: Keys adjust their font size and padding based on the window width (smaller for mobile devices).
  • Input Handling: The keyboard inserts text at the cursor position and supports text selection for backspace and other operations.

Styling

The keyboard uses CSS grid for layout, with row-specific grid templates to match a standard QWERTY keyboard. You can customize the appearance using the provided color props. For example:

<MTKeyboard
  keysBgColor="#f0f0f0"
  hoverBgColor="#cccccc"
  actionsBgColor="#aaaaaa"
  keysMainTextColor="#333333"
  keysVariantTextColor="#666666"
/>

Notes

  • The keyboard prevents default mouse down behavior to maintain focus on the target input.
  • In full-screen mode, the keyboard uses createPortal to render directly in the document.body.
  • The component assumes a QWERTY layout.
  • The keyboard supports left-to-right (ltr) direction to ensure consistent rendering.

License

MIT © Kiaksar. See LICENSE. Installation: npm install mt-react-captcha