Configuration
Every ChatMain prop, the layout toggles, and the composable Chat provider.
ChatMain props reference
Only clientId, loggedUserDetails and apiUrl are required. Everything else has a sensible default.
Connection & session
Viewport & theme
Details and examples: Themes & locale.
Locale & time
UI & callbacks
See Unread badge and Session end & token refresh.
Layout sections (layout prop)
Toggle parts of the default UI without writing components:
typescript
import { defaultChatLayoutConfig } from "@realtimexsco/live-chat"; export const chatLayoutConfig = { ...defaultChatLayoutConfig, // sidebar: true, // left panel wrapper // loggedUserDetails: true, // profile + new chat button // channelList: true, // conversation list // header: true, // channel header bar // messageList: true, // message bubbles // input: true, // composer // forwardModal: true, // forward dialog // threadsInbox: false, // "Threads" inbox button in the sidebar (off by default) // mentions: false, // "@" Mentions page button in the sidebar (off by default)};tsx
layout={{ input: false }} // read-only (no composer)layout={{ sidebar: false }} // hide the sidebar - messages onlylayout={{ forwardModal: false }} // disable the forward modallayout={{ loggedUserDetails: false, channelList: true }} // list without the profile blocklayout={{ threadsInbox: true }} // show the Threads inbox in the sidebarlayout={{ mentions: true }} // show the Mentions page button in the sidebarChat provider (composable mode)
Use Chat + ChatLayout when you need your own page wrapper but not a full ChatMain replacement.
tsx
"use client"; import { Chat, ChatLayout, type ChatComponents } from "@realtimexsco/live-chat";import { chatConfig } from "@/configs/chat.config"; const components: ChatComponents = { Avatar: MyAvatar }; export default function ChatPage() { return ( <div className="h-dvh min-h-0 overflow-hidden"> <Chat client={{ id: chatConfig.clientId }} accessToken={chatConfig.accessToken} loggedUserDetails={chatConfig.loggedUserDetails} apiUrl={chatConfig.apiUrl} socketUrl={chatConfig.socketUrl} themeColor={chatConfig.themeColor} uiConfig={{ components, classNames: { sidebar: "bg-slate-900" }, }} > <ChatLayout themeColor={chatConfig.themeColor} /> </Chat> </div> );}