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 🙏

© 2024 – Pkg Stats / Ryan Hefner

sexy-progressbar.js

v1.0.0

Published

A minimalist, modern and customizable progress bar implementation in vanilla JavaScript with zero dependencies

Downloads

54

Readme

sexy-progressbar.js

A sleek, modern, and sexy progress bar implemented in pure vanilla JavaScript with zero dependencies. Turn your boring progress indicators into eye-catching, professional UI elements! 🔥

✨ Features

  • 🎨 Sexy minimalist design
  • 📱 Fully responsive
  • ⚡ Zero dependencies
  • 🛠️ Highly customizable
  • 🎯 Pure vanilla JavaScript
  • 🖼️ PNG export capability
  • 🎭 Custom events support
  • 📦 Lightweight (~5KB minified)
  • 🔄 Smooth animations
  • 🎪 Modern transitions

📦 Installation

npm install sexy-progressbar.js

🚀 Quick Start

  1. Add a container element in your HTML:
<div id="progress-container"></div>
  1. Initialize your sexy progress bar:
const progressBar = new SexyProgressBar('progress-container');
progressBar.setProgress(75); // Set to 75%

🛠️ Configuration Options

const options = {
  // Essential Options
  width: '300px',           // Width of the bar (default: '100%')
  height: '20px',           // Height of the bar (default: '10px')
  color: '#4CAF50',         // Progress bar color (default: '#4CAF50')
  backgroundColor: '#eee',  // Background color (default: '#f0f0f0')
  
  // Visual Options
  borderRadius: '10px',     // Border radius (default: '5px')
  showPercentage: true,     // Show percentage text (default: true)
  animated: true,           // Enable animations (default: true)
  
  // Text Options
  textColor: '#333333',     // Percentage text color (default: '#333333')
  fontSize: '12px',         // Font size (default: '12px')
  fontFamily: 'Arial',      // Font family (default: 'Arial, sans-serif')
};

const progressBar = new SexyProgressBar('progress-container', options);

🎯 API Reference

Constructor

const progressBar = new SexyProgressBar(containerId, options);

Core Methods

setProgress(percentage)

Set the progress value (0-100)

progressBar.setProgress(75);

getProgress()

Get the current progress value

const currentProgress = progressBar.getProgress();

updateOptions(newOptions)

Update configuration options in real-time

progressBar.updateOptions({
  color: '#FF5733',
  height: '15px'
});

destroy()

Remove the progress bar from DOM

progressBar.destroy();

PNG Export Methods

generateProgressPNG(options)

Generate a PNG blob of the progress bar

const pngBlob = await progressBar.generateProgressPNG({
  width: 400,          // PNG width in pixels
  height: 40,          // PNG height in pixels
  progress: 75,        // Progress value (0-100)
  color: '#4CAF50',    // Bar color
  backgroundColor: '#eee',
  showPercentage: true,
  fontSize: 16,
  textColor: '#333',
  borderRadius: 5
});

downloadProgressPNG(filename, options)

Generate and download a PNG file

await progressBar.downloadProgressPNG('my-progress.png', {
  width: 500,
  height: 50,
  color: '#FF4081'
});

📡 Events

Listen for progress changes with custom events:

progressContainer.addEventListener('progressChange', (event) => {
  console.log('Progress updated:', event.detail.progress);
});

🎨 Sexy Styling Examples

Minimal & Clean

new SexyProgressBar('container', {
  width: '200px',
  height: '10px',
  color: '#2196F3',
  backgroundColor: '#E3F2FD',
  showPercentage: false
});

Bold & Professional

new SexyProgressBar('container', {
  width: '300px',
  height: '20px',
  color: '#FF4081',
  backgroundColor: '#FCE4EC',
  fontSize: '14px',
  textColor: '#880E4F'
});

Modern Gradient

new SexyProgressBar('container', {
  width: '100%',
  height: '15px',
  color: 'linear-gradient(45deg, #FF6B6B, #FF8E53)',
  borderRadius: '8px'
});

📱 Browser Support

  • ✅ Chrome (latest)
  • ✅ Firefox (latest)
  • ✅ Safari (latest)
  • ✅ Edge (latest)
  • ✅ Opera (latest)

💡 Common Use Cases

Loading States

const loader = new SexyProgressBar('loader');
let progress = 0;

const interval = setInterval(() => {
  progress += 10;
  loader.setProgress(progress);
  if (progress >= 100) clearInterval(interval);
}, 1000);

Upload Progress

const uploadBar = new SexyProgressBar('upload-progress');
fileUploader.onprogress = (event) => {
  const percentage = (event.loaded / event.total) * 100;
  uploadBar.setProgress(percentage);
};

Real-time Updates

const dynamicBar = new SexyProgressBar('dynamic');
setInterval(() => {
  const randomProgress = Math.floor(Math.random() * 100);
  dynamicBar.setProgress(randomProgress);
}, 2000);

🤝 Contributing

Issues and pull requests are welcome! Feel free to contribute to make this progress bar even sexier! 🌟

📄 License

MIT License - feel free to use this in your projects! Make your progress bars sexy everywhere! ✨

🙌 Credits

Created with ❤️ by Jolly


Make your web apps sexier, one progress bar at a time! 🚀