Add the IllumiChat widget to your React or Next.js application
This guide covers how to integrate the IllumiChat widget into React and Next.js applications, including component patterns, TypeScript support, and programmatic control.
Basic Next.js Integration
The recommended approach for Next.js uses the next/script component:
// components/IllumiChatWidget.tsx'use client';import Script from 'next/script';export function IllumiChatWidget() { return ( <Script src="https://widget.illumichat.com/v1/widget.js" data-assistant-id="YOUR_ASSISTANT_ID" strategy="lazyOnload" /> );}
Add it to your root layout so it loads on every page:
The 'use client' directive is required because next/script uses browser APIs. The widget itself is loaded asynchronously and will not affect your server-side rendering.
Configurable Component
Create a reusable component that accepts configuration props: