Ajouter

Lorem ipsum

Lorem ipsum

Easter egg

5 views

3 min

How to Add Confetti in Webflow

Learn how to add confetti on click or on form submission in Webflow with canvas-confetti.

In this tutorial, Sandro, cofounder of the Gemeos Webflow agency, shows you how to add confetti on click or on form submission in Webflow using the canvas-confetti library.

Example

Click the button to trigger the confetti

TriggerCustom attributeValue
Button clickdata-confettitrue
Form submissionJS listener on .w-form-doneAutomatic
Page loadDirect call on loadwindow.onload

1. Load the canvas-confetti library

In Page Settings > Head, add:


2. Trigger on button click

Add the custom attribute data-confetti="true" to any button. The script below detects every button with that attribute.

document.querySelectorAll('[data-confetti]').forEach(function(btn) {
btn.addEventListener('click', function() {
confetti({ particleCount: 150, spread: 70, origin: { y: 0.6 } });
});
});

3. Trigger after form submission

var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(m) {
m.addedNodes.forEach(function(n) {
if (n.classList && n.classList.contains('w-form-done')) {
confetti({ particleCount: 200, spread: 90, origin: { y: 0.5 } });
}
});
});
});
observer.observe(document.body, { childList: true, subtree: true });

good to know

canvas-confetti is a lightweight library (less than 10 KB gzipped) and doesn't depend on any other library. It supports plenty of options: particleCount, spread, colors, shapes (circle, square), origin (starting point). For a fireworks effect from the corners, trigger two bursts in parallel with different origins: { x: 0, y: 0.8 } and { x: 1, y: 0.8 }.

Conclusion

Confetti adds a celebratory moment to confirmation pages and important CTAs. Use cases: signup confirmed, purchase completed, goal reached.

Published on

You might be interested in these tutorials

Similar tutorials

SEO / GEO

5 min read

5 views

How to Set Up a Redirect in Webflow? (2026)

Updated on 19.12.2025 by Sandro DA SILVA

SEO / GEO

5 min read

5 views

Add structured data to your Webflow site?

Updated on 21.08.2025 by Sandro DA SILVA

No-code

5 min read

5 views

How to Obfuscate a Link in Webflow

Updated on 23.04.2025 by Sandro DA SILVA

Let’s f*****G GO !!

Ready to launch
Your business?

Alexandre

Max

Enora

Bryan

Cannelle

Tiphaine

You'll :heart: our collaboration...