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

react-confetti

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-confetti

React component to draw confetti for your party.

  • 6.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.8M
decreased by-6.75%
Maintainers
1
Weekly downloads
 
Created

What is react-confetti?

The react-confetti package is a React component that allows you to easily add confetti animations to your web applications. It is highly customizable and can be used to celebrate events, achievements, or any other occasion that calls for a festive touch.

What are react-confetti's main functionalities?

Basic Confetti Animation

This feature allows you to add a basic confetti animation to your React application with minimal setup. Simply import the Confetti component and include it in your JSX.

import React from 'react';
import Confetti from 'react-confetti';

const BasicConfetti = () => (
  <Confetti />
);

export default BasicConfetti;

Customizable Confetti

This feature allows you to customize various aspects of the confetti animation, such as the number of pieces, gravity, and colors. This makes it easy to tailor the animation to fit the theme of your application.

import React from 'react';
import Confetti from 'react-confetti';

const CustomConfetti = () => (
  <Confetti
    width={window.innerWidth}
    height={window.innerHeight}
    numberOfPieces={500}
    gravity={0.1}
    colors={['#ff0', '#f0f', '#0ff']}
  />
);

export default CustomConfetti;

Controlled Confetti

This feature allows you to control when the confetti animation is active. In this example, a button is used to toggle the confetti animation on and off, providing a more interactive experience for users.

import React, { useState } from 'react';
import Confetti from 'react-confetti';

const ControlledConfetti = () => {
  const [isConfettiActive, setIsConfettiActive] = useState(false);

  return (
    <div>
      <button onClick={() => setIsConfettiActive(!isConfettiActive)}>
        Toggle Confetti
      </button>
      {isConfettiActive && <Confetti />}
    </div>
  );
};

export default ControlledConfetti;

Other packages similar to react-confetti

Keywords

FAQs

Package last updated on 20 May 2022

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