Credits
Shout out to Magic UI for the inspiration. I actually discovered this package while browsing their website.
Getting Started
Installation
To get started, you will need to install the package. You can visit the Canvas Confetti page for more details... All the details 🙂.
Create Composable
Create a composable in your composables directory. You can name it useConfetti.ts.
Add this to the file:
useConfetti Composable
/**
* Easily add confetti effects to your Nuxt 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.