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

@ably/chat-react-ui-kit

v0.4.0

Published

A library of configurable components for use with @ably/chat

Readme

Ably Chat Header

Ably Chat React UI Kit

A library of configurable UI components for building chat applications with the Ably Chat SDK. This package provides ready-to-use React components that integrate seamlessly with @ably/chat to handle real-time messaging, presence, typing indicators, and more.

Getting started

Everything you need to get started with Ably Chat React UI Kit:

Installation

npm install @ably/chat-react-ui-kit @ably/chat @ably/pubsub-device react react-dom

Supported Platforms

This SDK supports the following platforms:

| Platform | Support | |--------------|------------------------------------------------------------------------------------------------------------| | Browsers | All major desktop browsers, including Chrome, Firefox, Edge and Opera. Internet Explorer is not supported. | | Node.js | Version 22 or newer. | | TypeScript | Fully supported, the library is written in TypeScript. | | React | Version 18 or newer. Includes providers and hooks for deep integration with the React ecosystem. |

[!NOTE] The Chat UI Components SDK can be installed from NPM and requires the core Ably Chat SDK as a peer dependency.

Core Components

App Component

Full application component that provides a complete chat interface out of the box:

  • Integrated sidebar for room navigation
  • Chat area with message display and input
  • Theme support (light/dark mode)
  • Avatar management

ChatWindow

A comprehensive chat interface for individual rooms featuring:

  • Message history with pagination
  • Real-time message display
  • Message editing and deletion
  • Reactions support
  • Typing indicators

Sidebar

A collapsible navigation component for managing multiple chat rooms:

  • Room list with activity indicators
  • Room creation and management
  • Presence and occupancy display
  • Theme toggle integration

Usage

The following example demonstrates how to set up a complete chat application using the core components. This includes initializing the Ably client, wrapping your app with the required providers, and rendering the App component with a sidebar and chat window:

import { createClient } from '@ably/pubsub-device';
import { createChatClient } from '@ably/chat';
import { ChatClientProvider } from '@ably/chat/react';
import {
  App,
  ThemeProvider,
  AvatarProvider,
  ChatSettingsProvider,
} from '@ably/chat-react-ui-kit';

// Don't forget to import the styles
import '@ably/chat-react-ui-kit/dist/style.css';

// Initialize the Ably Pub/Sub client with your API key and a unique client ID
const pubsubClient = createClient({
  key: '<your-ably-api-key>',
  clientId: 'user-' + Math.random().toString(36).slice(2, 9),
});

// Create a Chat client using the Ably Pub/Sub client
const chatClient = createChatClient(pubsubClient);

function MyApp() {
  return (
    // ThemeProvider: Enables light/dark mode theming with optional persistence
    <ThemeProvider options={{ persist: true, defaultTheme: 'light' }}>
      {/* AvatarProvider: Manages user avatar state across the application */}
      <AvatarProvider>
        {/* ChatSettingsProvider: Provides chat configuration context */}
        <ChatSettingsProvider>
          {/* ChatClientProvider: Makes the chat client available to all child components */}
          <ChatClientProvider client={chatClient}>
            {/*
              App: The main chat application component
              - Renders a Sidebar for room navigation (create, select, leave rooms)
              - Renders a ChatWindow for the active room with messages, typing indicators, and reactions
              - initialRoomNames: Pre-populate the sidebar with these room names
            */}
            <App initialRoomNames={['general', 'random']} />
          </ChatClientProvider>
        </ChatSettingsProvider>
      </AvatarProvider>
    </ThemeProvider>
  );
}

Using Individual Components

For more control, you can use ChatWindow and Sidebar independently:

import { useState } from 'react';
import { ChatRoomProvider } from '@ably/chat/react';
import {
  ChatWindow,
  Sidebar,
  ThemeProvider,
} from '@ably/chat-react-ui-kit';

// Assumes ChatClientProvider is already set up in a parent component

function CustomChatApp() {
  const [rooms, setRooms] = useState<string[]>(['general']);
  const [activeRoom, setActiveRoom] = useState<string | undefined>('general');

  const addRoom = (name: string) => {
    setRooms((prev) => (prev.includes(name) ? prev : [...prev, name]));
    setActiveRoom(name);
  };

  const leaveRoom = (name: string) => {
    setRooms((prev) => {
      const next = prev.filter((r) => r !== name);
      // Update active room based on the new list to avoid stale state
      if (next.length === 0) {
        setActiveRoom(undefined);
      } else if (name === activeRoom) {
        setActiveRoom(next[0]);
      }
      return next;
    });
  };

  return (
    <ThemeProvider>
      <div className="flex h-screen">
        {/* Sidebar: Manages room list, creation, and selection */}
        <Sidebar
          roomNames={rooms}
          activeRoomName={activeRoom}
          addRoom={addRoom}
          setActiveRoom={setActiveRoom}
          leaveRoom={leaveRoom}
        />

        {/* ChatWindow: Displays messages, input, typing indicators for the active room */}
        {activeRoom && (
          <ChatRoomProvider key={activeRoom} name={activeRoom}>
            <ChatWindow
              roomName={activeRoom}
              enableTypingIndicators={true}
            />
          </ChatRoomProvider>
        )}
      </div>
    </ThemeProvider>
  );
}

Releases

The CHANGELOG.md contains details of the latest releases for this SDK. You can also view all Ably releases on changelog.ably.com.

Contribute

Read the MAINTAINERS.md guidelines to contribute to Ably or Share feedback or request a new feature.

Support and known issues

For help or technical support, visit Ably's support page. You can also view the community reported Github issues or raise one yourself.