npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tglivechat/widget

v1.1.0

Published

TGLiveChat React component

Readme

@tglivechat/widget

NPM Version License

The official React and Next.js component for TGLiveChat.

If you are looking for the best alternative to Intercom for React, or you want a completely free customer support live chat widget that links directly to your Telegram, this is the package.

TGLiveChat is a frictionless, zero-bloat customer support widget that routes website visitor messages directly into your Telegram account (or a group). You reply to customers simply by texting them back on Telegram — no bulky dashboards, no hidden seats, just instant communication.

Installation

npm install @tglivechat/widget
# or
yarn add @tglivechat/widget
# or
pnpm add @tglivechat/widget

Usage (React / Next.js Client Components)

Since TGLiveChat relies on the browser document, ensure this component is rendered on the client side (e.g., using 'use client' in Next.js App Router).

'use client'

import { TGLiveChat } from '@tglivechat/widget'

export default function App() {
  return (
    <>
      <main>
        <h1>My Awesome App</h1>
      </main>
      
      {/* Best practice: Use an environment variable for your ID */}
      <TGLiveChat widgetId={process.env.NEXT_PUBLIC_TGLIVECHAT_WIDGET_ID || ''} />
    </>
  )
}

Environment Variables (Vercel / Netlify)

When deploying to Vercel, Netlify, or similar platforms, it's a standard practice to store your Widget ID in your environment variables.

For Next.js / Create React App: Add this to your .env or Vercel project settings:

NEXT_PUBLIC_TGLIVECHAT_WIDGET_ID=your-widget-id-here

For Vite:

VITE_TGLIVECHAT_WIDGET_ID=your-widget-id-here

Then use import.meta.env.VITE_TGLIVECHAT_WIDGET_ID within your component.

Next.js App Router Alternate (Zero Bundle Impact)

If you strictly want zero JavaScript bundle impact in Next.js, we highly recommend using Next.js's built-in target component instead of importing React components:

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="afterInteractive"
        />
      </body>
    </html>
  )
}

Props / Configuration

All visual settings (colors, theme, auto-open logic, welcome messages) should ideally be configured via your TGLiveChat Dashboard. However, you can use props for dynamic or code-level overrides:

| Prop | Type | Description | | :--- | :--- | :--- | | widgetId (required)| string | The unique ID of your TGLiveChat widget. | | color | string | Override the widget's accent color (e.g., "#FF5500"). | | title | string | Override the header title. | | subtitle | string | Override the header subtitle. | | agentPhoto | string | Override the agent avatar URL shown in the header. | | privacyUrl | string | Link to your Privacy Policy. Enabled GDPR checkbox. | | dir | "ltr" | "rtl" | Force text direction. Defaults to auto-detecting HTML dir. | | autoOpen | boolean | Automatically crack open the chat window on initial load. | | containerId | string | ID of a DOM element to inject the chat popup into (defaults to document.body). |

Architecture Security

The TGLiveChat widget is isolated completely within a Shadow DOM. This prevents your app's global CSS (like Tailwind resets) from breaking the chat UI, and prevents the widget's CSS from bleeding into your app.