Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js-confetti

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-confetti

JS Confetti library with zero dependencies, works without any config, TS typings included, adapts to user screen

  • 0.7.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
35K
increased by3.62%
Maintainers
1
Weekly downloads
 
Created
Source

npm version NPM Downloads npm bundle size

🎉 JavaScript Confetti library

💥 Supports emojies as confetties
⚡️ Zero dependencies used
🦄 Works without any config, yet configurable
🛠 Has TypeScript typings
🧩 Confetti speed adapts to user screen width

Links: GitHub | NPM | Demo

Install

You can install library from NPM using yarn or npm

yarn add js-confetti

Alternatively you can download script from CDN

<script src="https://cdn.jsdelivr.net/npm/js-confetti@latest/dist/js-confetti.browser.js"></script>

and then access JSConfetti global variable

Usage

Initialize instance of JSConfetti class and call addConfetti method

import JSConfetti from 'js-confetti'

const jsConfetti = new JSConfetti()

jsConfetti.addConfetti()

NOTE new JSConfetti() creates HTML Canvas element and adds it to page, so call it only once!

Customise confetties

Use emojies as confetties:

jsConfetti.addConfetti({
  { emojies: ['🌈', '⚡️', '💥', '✨', '💫', '🌸'] },
})

Customize confetties colors:

jsConfetti.addConfetti({
  confettiColors: [
    '#ff0a54', '#ff477e', '#ff7096', '#ff85a1', '#fbb1bd', '#f9bec7',
  ],
})

Customize confetties radius:

jsConfetti.addConfetti({
  confettiRadius: 6,
})

Customize confetties number:

jsConfetti.addConfetti({
  confettiRadius: 6,
  confettiesNumber: 500,
})

Combine different properties:

jsConfetti.addConfetti({
  emojies: ['🦄'],
  confettiRadius: 100,
  confettiesNumber: 30,
})

License

MIT

Keywords

FAQs

Package last updated on 26 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc