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

vue-snowfall

v1.1.8

Published

A Vue 3 composable for creating snowfall effects

Readme

Vue Snowfall

A customizable and performant Vue 3 composable for creating beautiful snowfall effects in your web applications.

✨ Features

  • 🎨 Highly Customizable - Configure speed, size, color, interval, chaos level, and more
  • Performant - Optimized with efficient DOM management, shared CSS animations, and automatic cleanup
  • 🎯 Flexible - Choose any container element or use the default body
  • 🔧 Easy to Use - Simple API with sensible defaults
  • 📦 Lightweight - Small bundle size, no external dependencies
  • 🎭 Vue 3 Compatible - Built for Vue 3 Composition API

📦 Installation

npm install vue-snowfall
# or
pnpm add vue-snowfall
# or
yarn add vue-snowfall

🚀 Quick Start

Basic Usage

import { useSnowfall } from 'vue-snowfall'
import { onMounted, onBeforeUnmount } from 'vue'

export default {
  setup() {
    const { startSnowflakes, stopSnowflakes } = useSnowfall()

    onMounted(() => {
      startSnowflakes()
    })

    onBeforeUnmount(() => {
      stopSnowflakes()
    })
  }
}

With Options

import { useSnowfall } from 'vue-snowfall'

const { startSnowflakes, stopSnowflakes } = useSnowfall({
  interval: 300,           // Create snowflake every 300ms
  minSpeed: 15,           // Minimum falling speed (seconds)
  maxSpeed: 25,           // Maximum falling speed (seconds)
  minSize: 10,            // Minimum size in pixels
  maxSize: 30,            // Maximum size in pixels
  color: '#ffffff',       // Snowflake color
  zIndex: 999,            // Z-index for snowflakes
  maxFlakes: 100,         // Maximum number of snowflakes (optional)
  chaos: 50,              // Chaos level for random movement (0-100)
  container: document.body // Container element or selector
})

startSnowflakes()

📖 API Reference

useSnowfall(options?)

Creates a snowfall effect instance.

Parameters

| Option | Type | Default | Description | |--------|------|---------|-------------| | container | HTMLElement \| string | document.body | Container element or CSS selector | | interval | number | 500 | Interval between creating snowflakes (ms) | | minSpeed | number | 20 | Minimum falling speed (seconds) | | maxSpeed | number | 30 | Maximum falling speed (seconds) | | minSize | number | 10 | Minimum snowflake size in pixels | | maxSize | number | 30 | Maximum snowflake size in pixels | | color | string | '#fff' | Snowflake color (hex, rgb, etc.) | | zIndex | number | 999 | Z-index for snowflakes | | maxFlakes | number \| null | null | Maximum number of snowflakes (null = unlimited) | | chaos | number | 50 | Chaos level for random movement (0-100, higher = more chaotic) |

Returns

An object with the following methods:

  • startSnowflakes() - Start the snowfall animation
  • stopSnowflakes() - Stop the animation and remove all snowflakes

🎨 Examples

Custom Container

import { useSnowfall } from 'vue-snowfall'

const { startSnowflakes, stopSnowflakes } = useSnowfall({
  container: '#snow-container', // CSS selector
  // or
  container: document.querySelector('.my-container') // Element
})

startSnowflakes()

Fast Snowfall

const { startSnowflakes } = useSnowfall({
  interval: 200,
  minSpeed: 5,
  maxSpeed: 10
})

startSnowflakes()

Slow, Large Snowflakes

const { startSnowflakes } = useSnowfall({
  interval: 1000,
  minSpeed: 30,
  maxSpeed: 50,
  minSize: 20,
  maxSize: 50
})

startSnowflakes()

Colored Snowflakes

const { startSnowflakes } = useSnowfall({
  color: '#ff6b9d' // Pink snowflakes!
})

startSnowflakes()

Chaotic Movement

const { startSnowflakes } = useSnowfall({
  chaos: 80 // Higher chaos = more random horizontal movement (0-100)
})

startSnowflakes()

Performance Optimization

const { startSnowflakes } = useSnowfall({
  maxFlakes: 50, // Limit to 50 snowflakes for better performance
  interval: 400
})

startSnowflakes()

🔧 Advanced Usage

Dynamic Configuration

import { ref, watch } from 'vue'
import { useSnowfall } from 'vue-snowfall'

const speed = ref(20)
let snowfall = null

watch(speed, (newSpeed) => {
  if (snowfall) {
    snowfall.stopSnowflakes()
  }
  snowfall = useSnowfall({ minSpeed: newSpeed, maxSpeed: newSpeed + 10 })
  snowfall.startSnowflakes()
}, { immediate: true })

Multiple Instances

const snowfall1 = useSnowfall({ container: '#container1' })
const snowfall2 = useSnowfall({ container: '#container2', color: '#ff0000' })

snowfall1.startSnowflakes()
snowfall2.startSnowflakes()

🎯 Performance Tips

  1. Use maxFlakes to limit the number of snowflakes for better performance on low-end devices
  2. Increase interval to create snowflakes less frequently
  3. Use a specific container instead of document.body when possible
  4. Stop snowfall when not visible (e.g., when component is unmounted or tab is hidden)
  5. Optimized rendering - The library uses a single shared CSS animation with CSS variables for optimal performance
  6. Automatic cleanup - Snowflakes are automatically removed when animation completes, reducing memory usage

🐛 Troubleshooting

Snowflakes not appearing

  • Make sure the container has a defined height
  • Check that the container is visible (not display: none)
  • Verify that startSnowflakes() is called after the container is mounted

Performance issues

  • Reduce maxFlakes or increase interval
  • Use a smaller container instead of the entire body
  • Consider stopping snowfall when the page is not visible

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.


Made with ❄️ by Erlan Kaparov