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 🙏

© 2025 – Pkg Stats / Ryan Hefner

tawk-react

v0.0.2

Published

React wrapper for tawk.to live chat

Readme

React Wrapper for Tawk.to Live Chat

A React component library for integrating Tawk.to live chat into your React applications. This library provides a simple and flexible way to add Tawk.to chat functionality using React components and hooks.

Features

  • Supports React 19.
  • Built with TypeScript.
  • Comprehensive API for controlling the chat widget.
  • Event subscription system for handling Tawk.to events.

Installation

You can install the package via npm:

npm install tawk-react

Usage

Basic Setup

To use the TawkLiveChat component, you need to provide your Tawk.to propertyId and widgetId:

  • propertyId: Go to Tawk.to Dashboard -> Administration -> Overview -> Value in Property ID field.
  • widgetId: Go to Tawk.to Dashboard -> Administration -> Channels -> Chat Widget -> Value in Widget ID field.
import { TawkLiveChat } from 'tawk-react'

const App = () => {
  return (
    <div>
      <h1>Tawk.to Integration Example</h1>
      <TawkLiveChat propertyId="your-property-id" widgetId="your-widget-id" />
    </div>
  )
}

export default App

Using Hooks

The library also provides hooks for interacting with the Tawk.to API as well as for listening Tawk.to events.

useTawkAction

This hook provides methods to control the chat widget programmatically. You can use it from any component in your codebase.

import { useTawkAction } from 'tawk-react'

const ChatControls = () => {
  const { maximize, minimize, endChat } = useTawkAction()

  return (
    <div>
      <button onClick={maximize}>Maximize Chat</button>
      <button onClick={minimize}>Minimize Chat</button>
      <button onClick={endChat}>End Chat</button>
    </div>
  )
}

export default ChatControls

Event Subscription

You can subscribe to Tawk.to events using the useTawkEvent hook.

import { useTawkEvent, TawkEvent } from 'tawk-react'

const ChatEventListener = () => {
  useTawkEvent(TawkEvent.onLoad, () => {
    console.log('Chat loaded')
  })

  return null
}

export default ChatEventListener

API Reference

TawkLiveChat Props

  • propertyId (string): Your Tawk.to Property ID.
  • widgetId (string): Your Tawk.to Widget ID.
  • visitor (optional): Object containing visitor information (name, email).
  • customStyle (optional): Object to customize widget styling. Only zIndex is supported.
  • autoStart (optional): Boolean to disable the auto-start connection of the chat widget.

Hooks

useTawkAction

Provides methods like start, shutdown, maximize, minimize, toggle, etc., to control the chat widget.

useTawkEvent

Allows subscribing to various Tawk.to events such as onLoad, onChatStarted, onChatEnded, etc.

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

  • Tawk.to for providing the live chat service.