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

keymash

v2.0.7

Published

Fast, type-safe keyboard binding library for the web

Readme

Keymash

npm version GitHub stars

The fastest, most flexible keyboard binding library for web apps.

import { keymash, ctrl, shift, press } from 'keymash';

const km = keymash();

// Type-safe, autocompletes, catches typos at compile time
km.bind(ctrl + press.s, () => save());
km.bind(ctrl + shift + press.p, () => commandPalette());

// Want Ctrl+K or Ctrl+O to open search? Use |
km.bind(ctrl + (press.k | press.o), () => openSearch());

Install

npm install keymash

Why Keymash?

Other keyboard libraries make you write "$mod+([0-9])" and hope you got their special syntax right. Keymash uses TypeScript operators that autocomplete.

  • International Keyboards — AltGr on European layouts, IME for CJK input, dead key compose sequences. Doesn't break the edge cases other libraries ignore.
  • Physical Key Codes — WASD game controls that work on AZERTY, QWERTZ, Dvorak. Bind by position, not character.
  • Strong Types — TypeScript operators that autocomplete. Typos caught at compile time, not runtime.
  • Tiny and Fast — ~2.86 KB gzipped. O(1) chord lookup using bigint bitmasks. Zero dependencies.
  • Modal UIs Made Simple — Multiple instances with independent state. Toggle between vim modes, command palettes, focus traps.
  • Conflict Detection — Dev mode warns about duplicate bindings and browser shortcuts you shouldn't override.

Modules

| Module | Description | Size | |--------|-------------|------| | keymash | Full library with introspection and dev warnings | ~2.86 KB | | keymash/react | React hooks for declarative keyboard binding | ~3.79 KB |

Quick Examples

Basic Binding

import { keymash, ctrl, press } from 'keymash';

const km = keymash({
  bindings: [
    { combo: ctrl + press.s, handler: () => save(), label: 'Save' },
    { combo: ctrl + press.z, handler: () => undo(), label: 'Undo' },
  ]
});

Scoped to an Element

const editor = document.getElementById('editor');
const editorKm = keymash({
  scope: editor,
  bindings: [
    { combo: ctrl + press.b, handler: () => bold() },
  ]
});
// Only active when focus is inside #editor

React Hook

import { useKeymash, ctrl, press } from 'keymash/react';

function Editor() {
  const { isActive, triggered } = useKeymash({
    bindings: [
      { combo: ctrl + press.s, handler: () => save(), label: 'Save' },
    ],
  });

  return <div>Last action: {triggered?.label}</div>;
}

Documentation

Full documentation, interactive demo, and API reference at zetlen.github.io/keymash.

License

MIT