Introduction
A complete real-time chat UI for React and Next.js - DMs, groups, threads, calls, attachments and full UI customization.
At a glance
@realtimexsco/live-chat drops a finished chat experience into your app: direct messages, groups, reactions, replies, forwarding, pins, stars, attachments, search, light/dark theme and locale/timezone - and lets you replace the whole chat or any single component.
Start here (5-minute overview)
- Install the package plus its peers
reactandreact-dom. Lexical, DOMPurify and every other chat dependency install automatically. Tailwind is not required. - Import the CSS once, globally:
@import "@realtimexsco/live-chat/styles.css". No@source, no Tailwind config. - Create
chat.config.tswithclientId,accessToken,loggedUserDetails,apiUrlandsocketUrl. - Render
<ChatMain {...chatConfig} />- it includes its own viewport wrapper. - Optionally pass
components,classNamesorfeatures. Omit any slot and the package default is used.
tsx
// Full page<ChatMain {...chatConfig} viewportHeight="screen" /> // Admin shell with a 4rem header (Elstar, Metronic, …)<ChatMain {...chatConfig} viewportHeight="calc(100dvh - 4rem)" /> // Inside your own bounded flex column (parent needs a height + min-h-0)<div className="flex min-h-0 flex-1 overflow-hidden"> <ChatMain {...chatConfig} viewportHeight="full" /></div>What's bundled
Socket.IO client, REST client, Zustand store, Radix UI, Lexical (rich-text composer and message viewer), DOMPurify, the emoji picker, Firebase (push), VideoSDK (calling) and all chat UI ship as regular dependencies of the package - they install and uninstall with it. Your app only installs the few peers it must own a single copy of, like React. See Prerequisites.