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

satyam-animated-spinner

v1.0.4

Published

A beautiful, customizable animated spinner component with multiple animation styles

Readme

satyam-animated-spinner

A beautiful, customizable animated spinner component with multiple animation styles. Perfect for loading states in any JavaScript/TypeScript project.

npm version license

✨ Features

  • 🎨 5 Beautiful Animation Styles: Circle, Dots, Bars, Ring, and Pulse
  • 🎯 Fully Customizable: Size, color, speed, and overlay options
  • 📦 Lightweight: Zero dependencies, minimal bundle size
  • 💪 TypeScript Support: Full type definitions included
  • 🌐 Framework Agnostic: Works with vanilla JS, React, Vue, Angular, and more
  • 🚀 Easy to Use: Simple API with sensible defaults

📦 Installation

npm install satyam-animated-spinner

Important: Don't forget to import the CSS file in your project!

import 'satyam-animated-spinner/dist/index.esm.css';

🚀 Quick Start

Basic Usage

import { AnimatedSpinner } from 'satyam-animated-spinner';
import 'satyam-animated-spinner/dist/index.esm.css';

// Create a spinner
const spinner = new AnimatedSpinner();

// Show it
spinner.show();

// Hide it when done
setTimeout(() => {
  spinner.hide();
}, 2000);

With Custom Options

import { AnimatedSpinner } from 'satyam-animated-spinner';
import 'satyam-animated-spinner/dist/index.esm.css';

const spinner = new AnimatedSpinner({
  type: 'dots',           // Animation type
  size: 60,               // Size in pixels
  color: '#ff6b6b',       // Primary color
  speed: 1.5,             // Animation speed in seconds
  overlay: true,          // Show overlay background
  overlayColor: 'rgba(0, 0, 0, 0.7)'
});

spinner.show();

🎨 Spinner Types

The package includes 5 different animation styles:

  • circle - Classic rotating circle with gap (default)
  • dots - Three pulsing dots
  • bars - Three bouncing bars
  • ring - Rotating ring with pulse effect
  • pulse - Single pulsing circle

📖 API Reference

Constructor Options

interface SpinnerOptions {
  type?: 'circle' | 'dots' | 'bars' | 'ring' | 'pulse';  // Default: 'circle'
  size?: number;                    // Default: 40
  color?: string;                   // Default: '#3b82f6'
  speed?: number;                   // Default: 1
  container?: HTMLElement;          // Default: document.body
  overlay?: boolean;                // Default: true
  overlayColor?: string;            // Default: 'rgba(0, 0, 0, 0.5)'
  className?: string;               // Optional custom CSS class
}

Methods

show()

Display the spinner.

spinner.show();

hide()

Hide the spinner with a fade-out animation.

spinner.hide();

setType(type)

Change the spinner animation type.

spinner.setType('dots');

setColor(color)

Update the spinner color.

spinner.setColor('#ff6b6b');

setSize(size)

Update the spinner size.

spinner.setSize(60);

setSpeed(speed)

Update the animation speed (in seconds).

spinner.setSpeed(2);

isShowing()

Check if the spinner is currently visible.

if (spinner.isShowing()) {
  console.log('Spinner is visible');
}

destroy()

Clean up and remove the spinner.

spinner.destroy();

💡 Usage Examples

With Async Operations

import { AnimatedSpinner } from 'satyam-animated-spinner';
import 'satyam-animated-spinner/dist/index.esm.css';

const spinner = new AnimatedSpinner({ type: 'ring' });

async function fetchData() {
  spinner.show();
  
  try {
    const response = await fetch('https://api.example.com/data');
    const data = await response.json();
    return data;
  } finally {
    spinner.hide();
  }
}

Multiple Spinners

import { AnimatedSpinner } from 'satyam-animated-spinner';
import 'satyam-animated-spinner/dist/index.esm.css';

// Full-page spinner
const pageSpinner = new AnimatedSpinner({
  type: 'circle',
  overlay: true
});

// Inline spinner in a specific container
const containerSpinner = new AnimatedSpinner({
  type: 'dots',
  size: 30,
  overlay: false,
  container: document.getElementById('my-container')
});

React Integration

import { useEffect, useRef } from 'react';
import { AnimatedSpinner } from 'satyam-animated-spinner';
import 'satyam-animated-spinner/dist/index.esm.css';

function MyComponent() {
  const spinnerRef = useRef(null);

  useEffect(() => {
    spinnerRef.current = new AnimatedSpinner({
      type: 'pulse',
      color: '#3b82f6'
    });

    return () => {
      spinnerRef.current?.destroy();
    };
  }, []);

  const handleClick = async () => {
    spinnerRef.current?.show();
    await someAsyncOperation();
    spinnerRef.current?.hide();
  };

  return <button onClick={handleClick}>Load Data</button>;
}

Vue Integration

<template>
  <button @click="loadData">Load Data</button>
</template>

<script>
import { AnimatedSpinner } from 'satyam-animated-spinner';
import 'satyam-animated-spinner/dist/index.esm.css';

export default {
  data() {
    return {
      spinner: null
    };
  },
  mounted() {
    this.spinner = new AnimatedSpinner({
      type: 'bars',
      color: '#10b981'
    });
  },
  beforeUnmount() {
    this.spinner?.destroy();
  },
  methods: {
    async loadData() {
      this.spinner.show();
      await this.fetchData();
      this.spinner.hide();
    }
  }
};
</script>

🎨 Customization

Custom Colors

// Solid color
const spinner = new AnimatedSpinner({
  color: '#ff6b6b'
});

// Use CSS variables
const spinner = new AnimatedSpinner({
  color: 'var(--primary-color)'
});

Custom Container

// Show spinner in a specific element
const spinner = new AnimatedSpinner({
  container: document.getElementById('loading-area'),
  overlay: false
});

Custom Styling

const spinner = new AnimatedSpinner({
  className: 'my-custom-spinner'
});

Then in your CSS:

.my-custom-spinner {
  /* Your custom styles */
  filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.5));
}

📄 License

MIT © satyam

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

🐛 Issues

If you find a bug or have a feature request, please open an issue on GitHub.