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

@leonabcd123/modern-caps-lock

v3.1.2

Published

A package that allows you to check whether caps lock is active or not

Readme

Modern Caps Lock

Modern Caps Lock provides an easy way to check whether Caps Lock is active, and it allows you to run your code whenever the Caps Lock state changes.

  1. Installation
  2. API
    1. onCapsLockChange
      1. Arguments
      2. Return value
    2. isCapsLockOn
      1. Arguments
      2. Return value
  3. Examples
    1. Print Caps Lock state after every change
    2. Get current Caps Lock state
  4. Support
    1. Supported Platforms
    2. Unsupported Platforms
  5. Limitations
  6. Credits

Installation

Example installation with npm:

npm install @leonabcd123/modern-caps-lock

API

onCapsLockChange

Runs the provided callback function whenever the Caps Lock state changes.

Arguments

callback: (capsState: boolean) => void: a function that takes one argument (capsState) and returns nothing. This function is executed after every Caps Lock state change.

Return value

void.

isCapsLockOn

Returns the current Caps Lock state.

Arguments

None.

Return value

capsState: boolean: a boolean indicating whether Caps Lock is on. If true, Caps Lock is on; if false, Caps Lock is off.

Examples

Print Caps Lock state after every change
import { onCapsLockChange } from "@leonabcd123/modern-caps-lock";

onCapsLockChange((capsState) => {
  console.log(`Caps Lock is ${capsState ? "on" : "off"}`);
});
Get current Caps Lock state
import { isCapsLockOn } from "@leonabcd123/modern-caps-lock";

if (isCapsLockOn()) {
  console.log("Caps Lock is on!");
} else {
  console.log("Caps Lock is off!");
}

Support

Supported Platforms
  • Windows
  • Mac
  • Linux
  • iPad
  • Platforms using GBoard
Unsupported Platforms
  • Platforms using Samsung keyboard

Limitations

Because of browser limitations, we can only detect the Caps Lock state after a KeyboardEvent or MouseEvent occurs. We currently detect updates to the Caps Lock state when the following events are fired:

  • keydown
  • keyup
  • mousedown
  • mousemove
  • wheel

Until one of these events is fired, the Caps Lock state defaults to false.

Credits

Created by Leon and fehmer.