Diwali lights for React, Next.js and Vue apps

Diwali Lights is framework-free: one async script that draws on its own canvas overlay. It doesn't touch your component tree or your CSS, so it works the same in React, Next.js, Vue, Svelte, Angular or a static site.

Free · one line of code · about 3 minutes
You'll need your free key first. It takes a minute and arrives by email.
Get my free code

Step by step

  1. Get your free key

    Register your production domain at worldofaiagents.com/diwali and verify your email. Keys also work on localhost for development.

  2. Add the script

    Use the snippet for your framework below. Load it once per app, not inside components that re-render.

  3. Optional: control it from code

    The widget exposes window.DiwaliLights with setStyle(), burst(), celebrate(), on() and off().

Your code looks like this

<script async src="https://worldofaiagents.com/diwali/w.js" data-key="DL-YOURKEY" data-style="grand"></script>

Change data-style to diyas, fireworks, toran, lanterns or grand whenever you like. Optional: data-sparkler="off" removes the cursor sparkler, data-until="2026-11-20" switches the lights off after a date, and data-position="right" moves the small on/off button.

Next.js (App Router)

// app/layout.tsx
import Script from 'next/script';

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        {children}
        <Script src="https://worldofaiagents.com/diwali/w.js" strategy="afterInteractive"
          data-key="DL-YOURKEY" data-style="grand" />
      </body>
    </html>
  );
}

React (Vite / Create React App)

Paste the script tag into index.html just before </body>:

<script async src="https://worldofaiagents.com/diwali/w.js" data-key="DL-YOURKEY" data-style="grand"></script>

Vue / Nuxt

// nuxt.config.ts
export default defineNuxtConfig({
  app: { head: { script: [{ src: 'https://worldofaiagents.com/diwali/w.js', async: true,
    'data-key': 'DL-YOURKEY', 'data-style': 'grand', tagPosition: 'bodyClose' }] } }
});

Control it from your app

window.DiwaliLights.setStyle('fireworks'); // diyas | fireworks | toran | lanterns | grand
window.DiwaliLights.celebrate();            // a volley of fireworks, e.g. after checkout
window.DiwaliLights.burst(x, y);            // one burst at a screen position
window.DiwaliLights.off();                  // and .on()
addEventListener('diwalilights:ready', e => console.log(e.detail.style));

Troubleshooting

It loads twice in development
React Strict Mode double-mounts components. Load the script from layout or index.html, not from a component effect. The widget also ignores a second copy.
TypeScript complains about window.DiwaliLights
Declare it: declare global { interface Window { DiwaliLights?: any } }.

Questions

Is there an npm package for a Diwali animation?

You don't need one. Diwali Lights is a hosted script that stays up to date, so you add one tag instead of a dependency, and it works in any framework.

Does it work with server-side rendering?

Yes. The script runs only in the browser after the page loads, so it has no effect on SSR, hydration or your bundle size.

Light up your React & Next.js site today

The lights on this page are the real widget. Try every style on the main page.

Get my free Diwali lights 🪔

Other guides