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

unreadmessages

v1.0.4

Published

Unread-Messages.js is a lightweight library that lets a user add floating number notifications to any object.

Readme

Unread-Messages.js

unread

About

Unread-Messages.js is a lightweight library that lets a user add mobile-like notification counter badge to any object with just one wrapper.

Install

NPM

npm

To install this package with NPM run the command below and link the needed javascript and css into your html file.

npm i unreadmessages --save

Direct Download

To use this package you need to link the needed javascript and css into your html file.

  <link rel="stylesheet" href="/src/css/style.css">

Because the library looks over the the page content for specific classes, place the script tag at the bottom of your HTML file or add the defer keyword to the tag, so the script will load after the HTML content.

  <script src="/src/js/main.js"></script>

Tutorial

Include the main css file a and javascript file. To initiate the, library two things are required, first a class of notification-container needs to be added to a wrapper element and the val data attribute needs to be defined inside of that element and you're done. If the data attribute is left empty it the displayed value will default to 0. To better illustrate the use of the library we'll be using FontAwesome icons as content for the wrappers.

  <div class="notification-container" data-val="">
        <i class="fas fa-bell" style="font-size: 45px;"></i>
  </div>

To fit the values with a reasonable size any value above 999 is dispalyed in a short-hand form. The displayed numbers shorthand follows the following convention

  • Any count 1000 and over like 1800 will be formated as 1.8k

  • Any value 1000000 and over like 1200,000 will be displayed as 1.2M

API

In addition to the data-val data attribute there are other attributes that can be used to further customize the badge.

Position

The position of the badge can be changed using the data-pos data attribute. If this attribute is not defined the badge position will default to top-right.

  <div class="notification-container" data-val="5" data-pos="bottom-left">
      <i class="fas fa-bell" style="font-size: 45px;"></i>
  </div>

Supported Positions

| Position | Tags | | ------------- |:-------------| | Top | top | | Top Right | top-right | | Top Left | top-left | | Bottom | bottom | | Bottom Right | bottom-right | | Bottom Left | bottom-left |

Color

You can also change the colors of the number tags by simply adding a data-val data attribute to your wrapper. Any color css-supported color name works as well as RGB values. If this attribute is not defined the badge will default to red.

  <div class="notification-container" data-val="5" data-color="blue">
    <i class="fas fa-bell" style="font-size: 45px;"></i>
  </div>

Hide After Click

You can decide how you want the badge to persist after mouse clicks by using the data-select-hide data attribute by default it is set to true but it can optionally explicitly set data-select-hide="false". This data attribute can also be set to false or False if you want the badge to persist after mouse clicks.

<div class="notification-container" data-val="5" data-select-hide="false">
      <div> Item of your choosing</div>
  </div>