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

universal-spinner

v1.1.0

Published

A lightweight, framework-agnostic SVG loading spinner for modern web applications.

Readme

universal-spinner

A lightweight, reusable SVG loading spinner for modern web applications.

  • Zero runtime dependencies
  • Framework-agnostic
  • SVG-based
  • Configurable size and color
  • Multiple spinner styles
  • Works with React, Angular, Vue, and vanilla JavaScript

Installation

Install the package from npm:

npm install universal-spinner

Import the spinner and stylesheet:

import { createSpinner } from "universal-spinner";
import "universal-spinner/styles.css";

Basic Usage

Create a spinner, mount it to a container, and start it:

const spinner = createSpinner({
  size: 32,
  color: "royalblue",
});

spinner.mount(container);
spinner.start();

Stop the spinner when loading is complete:

spinner.stop();

Variants

Choose a spinner using the variant option.

Pulse

The default three-dot loading animation.

createSpinner({
  variant: "pulse",
});

Circle

A circular rotating dot loader.

createSpinner({
  variant: "circle",
});

Wave

A horizontal wave-style loading animation.

createSpinner({
  variant: "wave",
});

Bounce

Three independently moving circles with configurable colors.

createSpinner({
  variant: "bounce",
  colors: ["red", "green", "blue"],
});

Each circle can have its own color.

Circle 1 → red
Circle 2 → green
Circle 3 → blue

Yin-Yang

A rotating Yin-Yang style loader.

createSpinner({
  variant: "yinyang",
});

Configuration

Size

Numbers are treated as pixels:

createSpinner({
  size: 48,
});

CSS size values are also supported:

createSpinner({
  size: "2rem",
});

Color

Use any valid CSS color:

createSpinner({
  color: "royalblue",
});
createSpinner({
  color: "#6366f1",
});

CSS variables are also supported:

createSpinner({
  color: "var(--primary-color)",
});

Bounce Colors

The bounce variant supports three independently configurable colors:

createSpinner({
  variant: "bounce",
  colors: [
    "#ef4444",
    "#22c55e",
    "#3b82f6",
  ],
});

If colors is not provided, the normal color option is used.

Spinner Controls

Start

spinner.start();

Starts the spinner.

Stop

spinner.stop();

Stops the spinner.

Mount

spinner.mount(container);

Adds the spinner to a DOM element.

Unmount

spinner.unmount();

Removes the spinner from the DOM.

Check Running State

spinner.isRunning();

Returns whether the spinner is currently running.

Framework Support

universal-spinner is framework-agnostic and works with:

  • Vanilla JavaScript / TypeScript
  • React
  • Angular
  • Vue
  • Other frameworks that can access a DOM element

No framework-specific package or adapter is required.

React

Use a ref to provide the DOM element to spinner.mount().

Angular

Use an element reference such as ElementRef and pass its native element to spinner.mount().

Vue

Use a template ref and pass the referenced DOM element to spinner.mount().

The spinner itself does not depend on React, Angular, Vue, or any other framework.

CSS

Import the stylesheet once in your application:

import "universal-spinner/styles.css";

The library does not automatically inject CSS into the document.

Available Variants

| Variant | Description | |---|---| | pulse | Three-dot sequential pulse | | circle | Circular rotating dots | | wave | Horizontal wave animation | | bounce | Three independently moving colored circles | | yinyang | Rotating Yin-Yang loader |

The default variant is pulse.

License

MIT