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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-sparklefall

v1.0.1

Published

React component wrapper for SparkleFall - Beautiful falling sparkle animations

Downloads

11

Readme

✨ React SparkleFall

React component wrapper for SparkleFall - Beautiful, customizable falling sparkle animations.

📦 Installation

npm install react-sparklefall sparklefall
# or
yarn add react-sparklefall sparklefall

🚀 Quick Start

import { SparkleFall } from 'react-sparklefall';
import 'sparklefall/styles.css';

function App() {
  return (
    <SparkleFall>
      <h1>✨ Sparkly Content!</h1>
    </SparkleFall>
  );
}

🎨 Examples

Basic Usage

<SparkleFall
  sparkles={['✨', '⭐', '💫', '🌟']}
  interval={800}
  maxSparkles={50}
>
  <div>Your content here</div>
</SparkleFall>

Custom Colors

<SparkleFall
  colors={['#FFD700', '#FFA500', '#FF8C00']}
  sparkles={['●', '◆', '■', '▲']}
  minSize={8}
  maxSize={20}
>
  <div>Golden sparkles!</div>
</SparkleFall>

Wind Effect

<SparkleFall
  wind={0.5}
  spin={true}
  minDuration={3}
  maxDuration={6}
>
  <div>Windy sparkles!</div>
</SparkleFall>

Controlled Animation

import { useState } from 'react';
import { SparkleFall } from 'react-sparklefall';

function ControlledSparkles() {
  const [paused, setPaused] = useState(false);
  
  return (
    <>
      <button onClick={() => setPaused(!paused)}>
        {paused ? 'Resume' : 'Pause'}
      </button>
      
      <SparkleFall paused={paused}>
        <div>Controlled sparkles!</div>
      </SparkleFall>
    </>
  );
}

🪝 useSparkleFall Hook

For programmatic control, use the useSparkleFall hook:

import { useSparkleFall } from 'react-sparklefall';

function SparkleControls() {
  const { start, stop, burst, clear, isRunning } = useSparkleFall({
    container: document.body,
    sparkles: ['🎉', '🎊', '✨'],
    autoStart: false
  });
  
  return (
    <div>
      <button onClick={start}>Start</button>
      <button onClick={stop}>Stop</button>
      <button onClick={() => burst(20)}>Burst!</button>
      <button onClick={clear}>Clear</button>
      <p>Status: {isRunning ? 'Running' : 'Stopped'}</p>
    </div>
  );
}

📋 Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | children | ReactNode | - | Content to render inside the sparkle container | | className | string | '' | CSS class for the container | | style | CSSProperties | {} | Inline styles for the container | | sparkles | string[] | ['✨', '⭐', '💫', '🌟'] | Array of sparkle characters | | colors | string[] \| null | null | Custom colors (null for emoji colors) | | interval | number | 800 | Time between new sparkles (ms) | | minSize | number | 10 | Minimum sparkle size (px) | | maxSize | number | 30 | Maximum sparkle size (px) | | minDuration | number | 2 | Minimum fall duration (seconds) | | maxDuration | number | 5 | Maximum fall duration (seconds) | | wind | number | 0 | Wind effect (-1 to 1) | | spin | boolean | true | Enable rotation | | maxSparkles | number | 50 | Max sparkles on screen | | autoStart | boolean | true | Start automatically | | zIndex | number | 9999 | Z-index of sparkle container | | paused | boolean | false | Pause/resume sparkles | | onStart | () => void | - | Callback when sparkles start | | onStop | () => void | - | Callback when sparkles stop |

🎯 Use Cases

Hero Section

<SparkleFall
  className="hero-sparkles"
  style={{ minHeight: '100vh' }}
  maxSparkles={100}
>
  <HeroContent />
</SparkleFall>

Button Click Effect

function SparkleButton() {
  const [showSparkles, setShowSparkles] = useState(false);
  
  const handleClick = () => {
    setShowSparkles(true);
    setTimeout(() => setShowSparkles(false), 3000);
  };
  
  return (
    <button onClick={handleClick} style={{ position: 'relative' }}>
      Click Me!
      {showSparkles && (
        <SparkleFall
          style={{ 
            position: 'absolute',
            inset: 0,
            pointerEvents: 'none'
          }}
          maxSparkles={30}
        />
      )}
    </button>
  );
}

Celebration Mode

function CelebrationMode({ celebrating }) {
  if (!celebrating) return null;
  
  return (
    <SparkleFall
      sparkles={['🎉', '🎊', '🎈', '🎆', '✨']}
      interval={200}
      maxSparkles={100}
      style={{
        position: 'fixed',
        inset: 0,
        pointerEvents: 'none',
        zIndex: 10000
      }}
    />
  );
}

🔧 TypeScript Support

Full TypeScript support is included:

import { SparkleFall, SparkleFallProps } from 'react-sparklefall';

const config: SparkleFallProps = {
  sparkles: ['✨'],
  wind: 0.5,
  maxSparkles: 100
};

<SparkleFall {...config}>
  <YourComponent />
</SparkleFall>

📝 License

MIT

🔗 Links


Made with ✨ by Theresa Summa