Embed a zero-dependency, ultra-lightweight (~10KB) Telegram chat bubble into Next.js 14/15.
Add the script tag inside your root app/layout.tsx using Next.js native next/script:
import Script from 'next/script'
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
{children}
<Script
src="https://cdn.tglivechat.com/w.js"
data-id="YOUR_WIDGET_ID"
strategy="lazyOnload"
/>
</body>
</html>
)
}Alternatively install @tglivechat/widget and render as a client component:
'use client'
import { TGLiveChat } from '@tglivechat/widget'
export default function ChatWrapper() {
return <TGLiveChat widgetId="YOUR_WIDGET_ID" />
}Your chat widget loads with zero CSS pollution using Shadow DOM encapsulation.
Create a free widget in 10 seconds.