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

dom-notifications

v2.0.2

Published

atom-inspired notifications

Readme

dom-notifications

semantic-release Greenkeeper badge nanocomponent 6

example gif

Have a look at the example page.

usage

Install with npm install dom-notifications --save and use something like browserify to create a bundle for the browser.

var domNotifications = require('dom-notifications')
var notifications = domNotifications(options)

document.body.appendChild(notifications.render())

notifications.add({message: 'You are now logged in'}) // defaults to `info`
notifications.add({message: 'This is a warning', type: 'warning'})
notifications.error('Oh noes: File not found')

By default this uses octicons icon classes that are not included automatically. Here's a CDN link that serves octicons that you can include in your HTML:

<style rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/octicons/3.5.0/octicons.min.css">

Have a look at the options to replace them with your own icon classes.

options

{
  repo: null, // Can be set to a GitHub url: 'http://github.com/finnp/notifications'
  icons: {
    error: 'octicon octicon-flame',
    warning: 'octicon octicon-alert',
    info: 'octicon octicon-info',
    success: 'octicon octicon-check',
    close: 'octicon octicon-x'

}

Setting the options.repo to a GitHub repository will add an Create an issue for this error button to the error notifications.

If you need more customization, instead of using the message property, you can also specify an element property and set it to DOMElement that will be the content.

For example with nanohtml:

notifications.add({
  type: 'error',
  element: html`<div>
    <strong>My super custom <em>message</em>!</strong>
  </div>`
})

Notifications extends Nanocomponent.

notifications.render(state?)

Creates the root element for the component. Call this ones to append it to the DOM. Optionally state is an array of notifications

notifications.add(notification)

Add and show a notification. notification should be an object with a message property and optionally one of the types 'error', 'warning', 'info', 'success' (defaults to 'info').

If notification is a string it will use this as a message and default to 'info'.

notifications.info(message)

Shortcut for .add({type: 'info', message: message})

notifications.error(message)

Shortcut for .add({type: 'error', message: message})

notifications.warning(message)

Shortcut for .add({type: 'warning', message: message})

notifications.success(message)

Shortcut for .add({type: 'success', message: message})

Use without styles

If you don't want the styles to be used (or applied automatically), you can also use the module like this:

var Notifications = require('dom-notifications/main')

var notifications = new Notifications()

// optionally apply styles yourself
var styles = require('dom-notifications/styles')
var insertCss = require('insert-css')
insertCss(styles)

Notes

The styles for the notifications were adapted from ember-cli-notifications and atom.