Skip to content

Easter egg3 min read

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:

<pre><code><script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1/dist/confetti.browser.min.js"></script>

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 });

Conclusion

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

Published on May 19, 2026

Sandro DA SILVA

Growth Marketer, Webflow expert, and jack-of-all-trades. Sandro handles commercial operations, ensures projects run smoothly, and addresses marketing-related issues (SEO, Tracking, Copywriting, etc).

You're going to working with us, guaranteed

Ready to launch your business?

get a quote

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