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

ccat-react-ts

v1.0.0

Published

CheshireCat React Widget

Downloads

5

Readme

React Chat Widget 🐱

React chat widget for the Cheshire Cat, ready to be used on any website.

Installation

You can install the widget via npm:

npm install @cheshire-cat-ai/widget-react

Or using yarn:

yarn add @cheshire-cat-ai/widget-react

How to import

Import the component and styles in your React application:

import { CheshireCatChat } from "@cheshire-cat-ai/widget-react";
import "@cheshire-cat-ai/widget-react/dist/style.css";

function App() {
  return (
    <div className="w-96 h-96 m-auto">
      <CheshireCatChat />
    </div>
  );
}

Props

The widget accepts various props for configuration. Together with the widget settings, you can set also the client settings, which are defined in the TypeScript API Client.

The available widget props are:

| Prop | Type | Default value | Description | | :---------: | :------------: | :------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------: | | dark | Boolean | false | true if the chat have to use the dark mode. false if not. | | why | Boolean | false | true if the chat have to show the WHY button in the CCat response. false if not. | | thinking | String | Cheshire Cat is thinking... | The text to visualize while the CCat answer is loading. | | placeholder | String | Ask the Cheshire Cat... | The text to visualize in the input placeholder. | | user | String | user | The user ID to pass to the cat via WS. | | primary | String | #F3977B | The color to use to stylize the chat. | | callback | Function | undefined | The function to call before passing the message to the cat. | | prompt | PromptSettings | Check PromptSettings | The prompt settings to pass to the cat for each user message. | | defaults | String[] | Check defaultMessages | The default messages to show before starting the conversation with the cat. | | features | Feature[] | Check Features | The features that the user can use. | | authKey | String | undefined | Authentication key for the Cheshire Cat API. | | baseUrl | String | localhost | Base URL of the Cheshire Cat API. | | port | String | 1865 | Port of the Cheshire Cat API. | | ws | Object | {} | WebSocket configuration options. | | files | String[] | [] | Accepted file types for upload. |

Usage Example

import React from "react";
import { CheshireCatChat } from "@cheshire-cat-ai/widget-react";
import "@cheshire-cat-ai/widget-react/dist/style.css";

function App() {
  const handleMessage = (message) => {
    console.log("Callback called.");
    return `Let's have a chat. ${message}`;
  };

  const handleWebSocketError = (error) => {
    console.log(error.description);
  };

  return (
    <div className="w-96 h-96 m-auto">
      <CheshireCatChat
        authKey="meow"
        baseUrl="localhost"
        port="1865"
        user="user"
        ws={{
          onFailed: handleWebSocketError,
        }}
        callback={handleMessage}
        defaults={[
          "Is everything ok?",
          "Who are you?",
          "What time is it?",
          "What's up?",
          "Hello Cheshire Cat!",
        ]}
        features={["record", "web", "file", "reset"]}
        files={["text/plain", "application/pdf", "text/markdown"]}
        dark={false}
        why={true}
        primary="#F3977B"
      />
    </div>
  );
}

export default App;

Event Handlers

You can handle various events by passing callback props:

import React from "react";
import { CheshireCatChat } from "@cheshire-cat-ai/widget-react";

function App() {
  const handleMessage = (message) => {
    console.log("Message:", message.text);
  };

  const handleUpload = (content) => {
    console.log(
      "Uploaded content:",
      content instanceof File ? content.name : content
    );
  };

  const handleNotification = (notification) => {
    console.log("Notification:", notification.text);
  };

  return (
    <div className="w-96 h-96 m-auto">
      <CheshireCatChat
        onMessage={handleMessage}
        onUpload={handleUpload}
        onNotification={handleNotification}
      />
    </div>
  );
}

The available event handlers are:

| Event Handler | Parameter | Description | | -------------- | ----------------- | ------------------------------------------------------------------------------- | | onMessage | Message | Called every time a new message is dispatched. | | onUpload | File / string | Called every time content is uploaded. It can be either a file object or a url. | | onNotification | Notification | Called every time a new notification is dispatched. |

TypeScript Support

The widget is built with TypeScript and provides full type support. Import the types you need:

import {
  CheshireCatChat,
  Message,
  Notification,
  PromptSettings,
  Feature,
} from "@cheshire-cat-ai/widget-react";