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

@omniaura/solid-hotkeys

v0.1.1

Published

SolidJS adapter for TanStack Hotkeys - keyboard shortcuts made easy

Readme

@omniaura/solid-hotkeys

SolidJS adapter for TanStack Hotkeys - keyboard shortcuts made easy

npm version License: MIT

Features

Type-safe hotkey bindings - Template strings (Mod+Shift+S, Escape) or parsed objects ✅ Cross-platform - Mod key automatically maps to Cmd on macOS, Ctrl on Windows/Linux ✅ Sequence support - Vim-style multi-key sequences (g g, d d) ✅ Key state tracking - Track which keys are currently held down ✅ Hotkey recording - Built-in UI helpers for letting users define their own shortcuts ✅ SolidJS primitives - Reactive primitives that work seamlessly with SolidJS

Installation

npm install @omniaura/solid-hotkeys @tanstack/hotkeys
# or
bun add @omniaura/solid-hotkeys @tanstack/hotkeys
# or
pnpm add @omniaura/solid-hotkeys @tanstack/hotkeys

Quick Start

import { createHotkey } from "@omniaura/solid-hotkeys";

function App() {
  createHotkey("Mod+S", (event) => {
    event.preventDefault();
    console.log("Save!");
  });

  return <div>Press Cmd/Ctrl+S to save</div>;
}

Usage

Basic Hotkey

import { createHotkey } from "@omniaura/solid-hotkeys";

function SaveButton() {
  createHotkey("Mod+S", (event, { hotkey }) => {
    event.preventDefault();
    handleSave();
  });

  return <button>Save (Cmd/Ctrl+S)</button>;
}

Conditional Hotkeys

import { createHotkey } from "@omniaura/solid-hotkeys";
import { Show, createSignal } from "solid-js";

function Modal(props) {
  // Hotkey only active when modal is open
  createHotkey("Escape", () => props.onClose(), () => ({
    enabled: props.isOpen,
  }));

  return (
    <Show when={props.isOpen}>
      <div class="modal">Press Escape to close</div>
    </Show>
  );
}

Scoped Hotkeys

import { createHotkey } from "@omniaura/solid-hotkeys";

function Editor() {
  let editorRef: HTMLDivElement | undefined;

  // Hotkey only works when editor is focused
  createHotkey("Mod+B", () => {
    toggleBold();
  }, { target: editorRef });

  return <div ref={editorRef} contentEditable />;
}

Hotkey Sequences (Vim-style)

import { createHotkeySequence } from "@omniaura/solid-hotkeys";

function VimEditor() {
  // 'g g' to go to top
  createHotkeySequence(["G", "G"], () => {
    scrollToTop();
  });

  // 'd d' to delete line
  createHotkeySequence(["D", "D"], () => {
    deleteLine();
  });

  // 'd i w' to delete inner word
  createHotkeySequence(["D", "I", "W"], () => {
    deleteInnerWord();
  }, { timeout: 500 });

  return <div>Try Vim shortcuts!</div>;
}

Track Held Keys

import { createHeldKeys, createKeyHold } from "@omniaura/solid-hotkeys";
import { For } from "solid-js";

function KeyTracker() {
  const heldKeys = createHeldKeys();
  const shiftHeld = createKeyHold("Shift");

  return (
    <div>
      <div>Shift: {shiftHeld() ? "Pressed" : "Not pressed"}</div>
      <div>
        All held keys:
        <For each={heldKeys()}>{(key) => <kbd>{key}</kbd>}</For>
      </div>
    </div>
  );
}

Hotkey Recorder

import { createHotkeyRecorder } from "@omniaura/solid-hotkeys";
import { createSignal, Show } from "solid-js";

function ShortcutSettings() {
  const [shortcut, setShortcut] = createSignal("Mod+S");

  const recorder = createHotkeyRecorder({
    onRecord: (hotkey) => {
      setShortcut(hotkey);
    },
    onCancel: () => {
      console.log("Recording cancelled");
    },
  });

  return (
    <div>
      <div>Current shortcut: {shortcut()}</div>
      <button onClick={recorder.startRecording}>
        {recorder.isRecording() ? "Recording..." : "Edit Shortcut"}
      </button>
      <Show when={recorder.recordedHotkey()}>
        <div>Preview: {recorder.recordedHotkey()}</div>
      </Show>
    </div>
  );
}

Global Configuration

import { HotkeysProvider } from "@omniaura/solid-hotkeys";

function App() {
  return (
    <HotkeysProvider
      defaultOptions={{
        hotkey: {
          preventDefault: true,
          enabled: true,
        },
        hotkeySequence: {
          timeout: 1000,
        },
      }}
    >
      <YourApp />
    </HotkeysProvider>
  );
}

API

createHotkey(hotkey, callback, options?)

Register a keyboard hotkey.

  • hotkey: String like "Mod+S" or "Escape", or accessor function
  • callback: Function called when hotkey is pressed
  • options: Optional configuration (or accessor function for reactive options)

Options:

  • enabled: Whether the hotkey is active (default: true)
  • preventDefault: Prevent default browser behavior (default: false)
  • stopPropagation: Stop event propagation (default: false)
  • target: DOM element to attach listener to (default: document)
  • platform: Override platform detection

createHotkeySequence(sequence, callback, options?)

Register a multi-key sequence (Vim-style).

  • sequence: Array of hotkey strings like ["G", "G"], or accessor function
  • callback: Function called when sequence completes
  • options: Optional configuration (or accessor function)

Options:

  • enabled: Whether sequence detection is active (default: true)
  • timeout: Max time between keys in ms (default: 1000)
  • platform: Override platform detection

createHeldKeys()

Returns a signal accessor for array of currently held keys.

const heldKeys = createHeldKeys();
// heldKeys() => ["Shift", "A"]

createHeldKeyCodes()

Returns a signal accessor for map of held keys to their physical key codes.

const heldCodes = createHeldKeyCodes();
// heldCodes() => { "Shift": "ShiftLeft", "A": "KeyA" }

createKeyHold(key)

Returns a signal accessor that's true when specific key is held.

const isShiftHeld = createKeyHold("Shift");
// isShiftHeld() => true/false

createHotkeyRecorder(options)

Hotkey recording interface.

Options:

  • onRecord: Callback when hotkey is recorded
  • onCancel: Callback when recording is cancelled

Returns:

  • isRecording: Signal accessor for recording state
  • recordedHotkey: Signal accessor for current hotkey preview
  • startRecording: Function to start recording
  • stopRecording: Function to stop recording
  • cancelRecording: Function to cancel recording

HotkeysProvider

Optional provider for global configuration.

Cross-Platform Keys

Use Mod for cross-platform modifier:

  • Mod+SCmd+S on macOS, Ctrl+S on Windows/Linux
  • Mod+Shift+PCmd+Shift+P on macOS, Ctrl+Shift+P elsewhere

Related

License

MIT © omniaura