DevExtreme v24.2 is now available.

Explore our newest features/capabilities and share your thoughts with us.

Your search did not match any results.

React Chat - Overview

Chat is an interactive interface that allows users to send and receive messages in real time.

To get started with the DevExtreme Chat component, refer to the following step-by-step tutorial: Getting Started with Chat.

The demo implements basic Chat functionality: specifies initial messages, updates the conversation with new incoming and outgoing messages, manages users, and links two chats in real-time.

DevExtreme Accessibility Compliance
DevExtreme component libraries meet a variety of WCAG and Section 508 compliance standards. To assess this demo’s accessibility level, click the Run AXE® Validation button to launch the AXE® web accessibility evaluation tool.
All trademarks or registered trademarks are property of their respective owners. AXE® Terms of Use
The overall accessibility level of your application depends on the Chat features used.
To give you the ability to edit code on the fly, the demo uses SystemJS. For this reason, launching the demo takes some time. We strongly recommend that you do not use this approach in real projects.
Backend API

Messages

To specify initial messages, you can either populate the items array (shown in this demo) or use a dataSource.

Use the following API to render new messages:

  • If you use items, update the array with the new message.
  • If you use a dataSource, implement load and insert operations.

Users

To specify the chat owner, set the user property. Owner messages align to the right (or left in RTL mode) and do not display the name or avatar.

Each message includes information about the sender (author): name, avatar, and alternative avatar text. If no avatar is set, the user's initials are displayed instead.

Events

If a user enters a message, the Chat raises the messageEntered event. Use the event handler to process the message. For example, you can display the message in the message feed and send the message to the server for storage.

When users start or finish typing, the Chat raises typingStart and typingEnd events. Use these events to manage the typingUsers array. The Chat uses this array to display a list of active users.