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

@0xbot/chat-react

v1.0.16

Published

A React component for building chat interfaces with streaming support

Downloads

35

Readme

Chat Library React

A React component for building chat interfaces with streaming support.

Installation

npm install @0xbot/chat-react
# or
yarn add @0xbot/chat-react
# or
pnpm add @0xbot/chat-react

Usage

import React from 'react'
import { ChatLibrary } from '@0xbot/chat-react'
import '@0xbot/chat-react/dist/index.css' // Import the CSS

const App = () => {
  return (
    <ChatLibrary
      apiKey="your-api-key"  // required  
      serverUrl="your-server-url" // not required
      UserAvatar={<YourUserAvatar />} // required
      AgentAvatar={<YourAgentAvatar />} // required
      loadingText="AI is thinking..." // not required
      emptyText="No messages yet" // not required
      tradeApiKey="xxxx-xxxx-xx"
    />
  )
}

export default App

Props

| Prop | Type | Required | Default | Description | |------|------|----------|---------|-------------| | apiKey | string | Yes | - | Your API key for authentication | | serverUrl | string | Yes | - | The server URL for API requests | | UserAvatar | ReactNode | Yes | - | The avatar component for user messages | | AgentAvatar | ReactNode | Yes | - | The avatar component for agent messages | | loadingText | string | No | 'AI is thinking...' | Text to display while loading | | emptyText | string | No | 'No messages yet' | Text to display when there are no messages | | theme | object | No | {} | Theme configuration object | | tradeApiKey | string | No | '' | trade api key |

Features

  • Real-time message streaming
  • Markdown support
  • Customizable theme
  • Responsive design
  • Built-in loading states
  • Error handling

Dependencies

This library requires the following peer dependencies:

  • React 18 or higher
  • React DOM 18 or higher
  • @types/react 18 or higher (for TypeScript projects)
  • @types/react-dom 18 or higher (for TypeScript projects)

Styling

You can customize the appearance of the chat component by overriding the following CSS classes:

/* Main container */
.chat-library {
  box-sizing: border-box;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

/* Bottom bar */
.chat-bar {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Input field */
.chat-bar-input {
  flex: 1;
  height: 44px;
  outline: none;
  border-radius: 99999px;
  border: 1px solid #ccc;
  background-color: transparent;
  color: #fff;
  padding: 0 16px;
  min-width: 0;
}

/* Send button */
.chat-bar-send {
  flex: none;
  width: auto;
  border: 1px solid;
  height: 48px;
  padding: 0 32px;
  border-radius: 99999px;
  cursor: pointer;
  background-color: transparent;
  transition: all 0.2s ease-in-out;
}

/* Send button hover */
.chat-bar-send:hover {
  background-color: var(--primary-color);
  color: white !important;
}

/* Chat container (excluding bottom bar) */
.chat-container {
  flex: 1;
  overflow-y: scroll;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* Hide scrollbar */
.chat-container::-webkit-scrollbar {
  display: none;
}

/* Chat message list */
.chat-container-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Message bubble */
.message-bubble {
  padding: 12px 16px;
  border-radius: 8px;
  max-width: 90%;
  font-size: 14px;
  word-break: break-all;
  line-height: 24px;
}

@media (min-width: 768px) {
  .message-bubble {
    max-width: 70%;
    font-size: 13px;
  }
}

/* Avatar */
.chat-avatar {
  width: 44px;
  height: 44px;
  max-width:44px;
  max-height:44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
}

/* Message bubble background */
.chat-message {
  background-color: rgba(255, 255, 255, 0.1)
}

/* Message container */
.message-container {
  display: flex;
}

/* Delete button */
.chat-bar-trash {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  color: #fff;
  cursor: pointer;
}

/* Loading state */
.message-loading {
  color: #fff;
  font-style: italic;
}

/* Empty message state */
.message-empty {
  color: #fff;
  font-style: italic;
  text-align: center;
}

/* Trade modal */
.dodo-swap {
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

How to Override Styles

You can override these styles by adding your own CSS rules after importing the library's CSS. For example:

/* Import the library's CSS first */
@import '@0xbot/chat-react/dist/index.css';

/* Then add your custom styles */
.chat-bar-input {
  border-color: #ff0000;
  background-color: #f0f0f0;
  color: #333;
}

.chat-bar-send {
  background-color: #4CAF50;
  color: white;
  border: none;
}

License

MIT