Confetti
Display some confetti effect in your nuxt app.
Credits
Shout out to Magic UI for the inspiration. I actually discovered this package while browsing their website.
Installation
To get started, you will need to install the package. You can visit the Canvas Confetti page for more details... All the details 🙂.
npm install canvas-confetti
Create Composable
Create a composable in your composables
directory. You can name it useConfetti.ts
.
Add this to the file:
/**
* Easily add confetti effects to your Nuxt 3 application
*
* @see https://github.com/catdad/canvas-confetti
*/
import useConfetti from "canvas-confetti";
export default useConfetti;
Usage
Basic
We can just call the useConfetti
method to trigger the confetti.
Random Direction
This is how you can shoot confetti off in a random direction.