For AI agents: Find a documentation index at https://talkjs.com/llms.txt (full content at https://talkjs.com/llms-full.txt). Get a markdown version of any page by appending .md to its URL path.
Skip to content

React chat UI

React chat UI with the backend included

TalkJS gives you three ready React chat UIs: the Inbox, the Chatbox and the conversation list. Tell a component your app ID, who's chatting and which conversation to open, and it shows that conversation from TalkJS with typing indicators, read receipts, unread counts and online status already working.

import { Chatbox } from '@talkjs/react-components';
import '@talkjs/react-components/default.css';

function Chat() {
  const appId = '<APP_ID>';

  return (
    <Chatbox
      style={{ width: "400px", height: "600px" }}
      appId={appId}
      userId="sample_user_alice"
      conversationId="sample_conversation"
    />
  );
}
Dev A
Hey, I'm trying to lift state up from a child component, but I'm getting undefined errors. Any ideas?
8m ago
You
Are you passing the state and the setState function correctly as props?
6m ago
Dev A
I think so, yes.
5m ago
ok-hand
thinking
You
Maybe you're not binding the handler in the constructor. That might be the issue.
2m ago
Dev A
typing...
just now
Write a reply...
You
Hey, I’m having trouble accessing my account. It says my password is incorrect.
5m ago
SupportBot
Hi there! No problem — let’s get that sorted. Have you tried resetting your password using the 'Forgot password?' link?
4m ago
thinking
thumbs-up
You
Yes, but I haven’t received the reset email yet.
3m ago
SupportBot
Thanks for confirming. I’ve just sent a new reset link to your email. Please check your inbox and spam folder.
2m ago
SupportBot
Is there anything else I can help you with?
just now
Got it — checking my inbox now!
Inbox

The Inbox shows the user's conversations on the left and the selected one on the right. It's the messaging center of your app, usually on its own page. Under 700 pixels wide it switches to a mobile layout.

Chatbox

The Chatbox is the right half of the Inbox: one conversation. It takes up less space, so you can put it next to an order confirmation, a booking or a user profile. The conversation list is the left half, and it works on its own too.

Popup

Want a chat that opens from a button? Put a Chatbox in your own popup or drawer and place it wherever your design needs it. Apps on our Classic SDK also have a ready-made Popup.

Add the React chat UI to your app

Install @talkjs/react-components and @talkjs/core, then render the UI you want. This Inbox shows every conversation of a sample user in our test mode, so it runs before you've created any users of your own.

Before you go live, turn on authentication, so that only your users can open their chats.

import { Inbox } from '@talkjs/react-components';
import '@talkjs/react-components/default.css';

<Inbox
  appId="<APP_ID>"
  userId="sample_user_alice"
/>

Customize the React chat UI

Start with props: colorScheme="dark" turns on dark mode, and chatHeaderVisible={false} hides the header. Colors and spacing are CSS. To go further, replace one part, such as the chat header, with your own React component, or start a full theme from the source at github.com/talkjs/themes.

What does a React chat UI need from the server?

Much of what users see in a chat comes from the server. Is the other person typing? Did your message arrive, and did they read it? How many messages are unread, and who’s online? A UI kit draws all of that, but your code has to supply it.

With chatscope’s Chat UI Kit, for example, you pass in each message yourself (its text, time, and sender), and the chat state lives in your code or in their separate use-chat hook.

Search conversations
DT
Design team
10:42
Taylor: New notes.
2
S
Sebastian
10:41
You: It works now, thanks.
T
Taylor
10:35
Thanks for checking!
Chat logo
Sebastian
Online
Can you open the preview?
10:39
I’ve updated the link.
10:40
It works now, thanks.
10:41
The conversation list shows two unread messages. The Chatbox shows Sebastian is online, and the double check marks show he’s read the last message.

Our React components get all of that from TalkJS, working from the first render. You also get:

  • Reactions, replies, and editing or deleting your own messages, each on or off per user role
  • File and image sharing, voice messages, and an emoji picker
  • 39 UI languages
  • Every message kept on every plan

And when someone misses a message, TalkJS can send an email, a mobile push notification, or an SMS. All three are on every plan; SMS is charged separately.

FAQs

Yes, the Chatbox in @talkjs/react-components. Give it your app ID, a user ID and a conversation ID, and it shows that one conversation.

Yes. A webhook tells your server when a user sends a message, your server calls the AI model you choose, and the REST API posts the reply into the conversation, where the React chat UI shows it like any other message. TalkJS doesn't include a built-in AI agent, so you stay in control of the model and its logic. See React AI chatbot.

TalkJS is free in development mode with full feature access. You only need a paid plan once you go live with real users. Basic is $279 a month ($239 billed annually) for 10,000 monthly active users. See Pricing.

More on React: React chat SDK, the customizable chat component, and the embeddable chat widget.