Vue Confetti Explosion

1.0.2 · active · verified Sun Apr 19

vue-confetti-explosion is a lightweight and performant Vue 3 component designed to create customizable confetti explosion animations. Currently at version 1.0.2, this library is a direct port from popular Svelte and React counterparts, offering a consistent API for triggering celebratory visual effects within Vue applications. It focuses on simplicity and performance, generating a specified number of confetti particles with options for size, duration, color arrays, and explosion force. While it doesn't specify a strict release cadence, updates are likely tied to major Vue 3 ecosystem shifts or bug fixes. A key differentiator is its minimal API and ease of integration into `<script setup>`-style Vue components, making it an ideal choice for adding quick, dynamic visual flair without significant overhead.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to programmatically trigger a confetti explosion on a button click, ensuring the component re-renders for each new effect with custom options.

import { nextTick, ref } from "vue";
import ConfettiExplosion from "vue-confetti-explosion";

const visible = ref(false);

const explode = async () => {
  visible.value = false;
  await nextTick();
  visible.value = true;
};

<template>
  <div>
    <button @click="explode">Trigger Confetti</button>
    <ConfettiExplosion v-if="visible" :particleCount="200" :duration="4000" :force="0.6" :colors="['#F06292', '#BA68C8', '#64B5F6', '#81C784', '#FFD54F']"/>
  </div>
</template>

view raw JSON →