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

nanosplash

v4.0.18

Published

The tiny loading screen for web artisans

Readme

Nanosplash

The tiny loading screen for web artisans

CI Production: Build, Test Coverage Status


Nanosplash is a 3KB zero-dependency library for effortless loading screens. Its 2-function API lets you add fullscreen or container-based spinners in seconds, fully customizable with CSS. Fast, beautiful, and simple.

// Display spinner fullscreen
show('Loading')

// Display spinner in target
show('Loading', '#my-div')

// Hide spinner
hide()

Features

  • Tiny: Only 3KB
  • Performance: Created to be fast.
  • Zero dependencies: Pure JS.
  • Beautiful: Good and generic design.
  • Modules: Supports ESM, CJS, and IIFE.
  • TypeScript support: Fully typed.
  • 2 Function API: Easy to use.

Installation

Include Nanosplash in your project via your preferred method (e.g., CDN, module bundler). Example:

<script src="https://unpkg.com/nanosplash/dist/iife/ns.iife.js"></script>

or

npm install nanosplash

API Documentation

Show

The show function displays a Nanosplash loading indicator on your page. You can pass in optional text to display with the spinner, and an optional target element (or CSS selector) to control where it appears. If no target is provided, Nanosplash will create a fullscreen splash covering the entire viewport.

show(text?: string, target?: string | Element): number

Examples:

Fullscreen spinner only:

ns.show()

Fullscreen text and spinner:

ns.show('Loading...')

Spinner only within a specific element:

ns.show(null, '#my-div')

Text and spinner within a specific element:

ns.show('Please wait', '#my-div')

Hide

The hide function removes one or more Nanosplash loading indicators from your page. By default, it removes the oldest fullscreen splash (FIFO). If you want to remove a specific splash, you can pass its ID (returned by show). You can also remove all splashes at once by passing the wildcard '*'.

hide(id?: number | '*'): void

Examples:

Remove the oldest (FIFO) fullscreen Nanosplash:

ns.hide()

Remove a specific Nanosplash by ID:

const id = ns.show() // 1700000000000
ns.hide(id)

Remove all Nanosplashes:

ns.hide('*')

Customization

Nanosplash is designed to be fully customizable with CSS. You can style its key parts using these selectors:

| Selector | Description | |------------------|------------------------------------------| | .nsh::before | Backdrop | | .ns | Main wrapper for the splash | | .nst | Text element | | .nss | Spinner element |

Examples

Here’s a quick snippet to show a loading indicator while fetching data:

<div id="my-div"></div>

<script>
  // Show a splash while loading
  ns.show('Fetching data...', '#my-div')

  fetch('/api/data')
    .then(res => res.json())
    .then(data => {
      // Process data
    })
    .finally(() => {
      // Hide splash
      ns.hide()
    })
</script>

💖 Contributing & Feedback

Found a bug or have a feature request? Visit the GitHub repository and open an issue or pull request!