Add

Lorem ipsum

Lorem ipsum

A
A
A
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.

Good to know

Heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Lorem ipsum dolor sit amet consectetur.

Lorem ipsum dolor sit amet consectetur. Aliquam orci sagittis dignissim sapien praesent donec.

Lorem ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

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...