RealTimeX
Start For Free

RealTimeX

Package Documentation

IntroductionPrerequisitesInstallationProject setupQuick start
Package structureConfigurationComponentsHooksAPI integrationSocket events
OverviewReplace entire UIReplace componentsStyle with classNamesThemes & localePhone & video callingIn-call control barFeatures
TroubleshootingFAQVersion historyBest practicesSupport & contact

Package Reference

Configuration Options

Prop reference

All configuration is passed as props to ChatMain (or, in composable mode, to Chat and uiConfig). The table below lists every available prop, its type, default, and purpose. Worked examples for the most common groups follow after the table.

PropTypeDefaultDescription
clientIdstring—Required. Tenant / client id
accessTokenstring—Required. JWT access token
loggedUserDetailsobject—Required. { _id, name, email } — _id must match the JWT
apiUrlstring—Required. REST API base URL, must end with /api/v1
socketUrlstringderivedOptional socket host (no /api/v1). Defaults to apiUrl without /api/v1
queryParamsRecord<string, string | number | boolean>—Shared query params applied to APIs selected by queryParamApis
queryParamApisChatApiKey[]['get']Which API groups receive queryParams ("get", "all", or specific keys)
queryParamsByApiChatQueryParamsByApi—Different query params per API key (including presignedUrls)
viewportHeight"full" | "screen" | string"full"Chat root height — use "screen" or a calc() under a fixed app header so only the message list scrolls
viewportClassNamestring—Extra classes on the built-in viewport wrapper
themeColorstring—Brand accent hex; writes --chat-theme* CSS variables at runtime
colorMode"light" | "dark"—Controlled light/dark mode
defaultColorMode"light" | "dark""light"Initial mode when uncontrolled
onColorModeChange(mode) => void—Called when the theme changes
showColorModeTogglebooleantrueShow the built-in light/dark toggle
localestringbrowserBCP 47 locale, e.g. "en-US"
timeZonestringbrowserIANA timezone, e.g. "Asia/Kolkata"
hour12booleanlocaletrue = 12-hour clock
showDateTimeSettingsbooleantrueShow the in-panel date/time button
layoutChatLayoutConfigall trueToggle visibility of UI sections
componentsChatComponents—Replace UI slots — see Customization and Components
classNamesChatClassNames—Per-region CSS class overrides (merged with defaults)
featuresChatFeatures—Phone/video call flags and callbacks
uiConfigUIConfig—Advanced bag merged with components / classNames / features when using the composable Chat entry
error / infostring | null—Message shown in the alert bar
onErrorDismiss / onInfoDismiss() => void—Dismiss the alert bar

Credentials and endpoints

These props are required for a working session. Keep them in chat.config.ts and ensure loggedUserDetails._id matches the JWT. See Prerequisites for field notes.

tsx
<ChatMain
  clientId={chatConfig.clientId}
  accessToken={chatConfig.accessToken}
  loggedUserDetails={chatConfig.loggedUserDetails}
  apiUrl={chatConfig.apiUrl}
  socketUrl={chatConfig.socketUrl}
/>

Viewport, theme, and locale

Set height so the chat fills the available viewport without scrolling the whole page. Theme and locale props control accent color and timestamp formatting across every slot.

tsx
<ChatMain
  {...chatConfig}
  viewportHeight="calc(100dvh - 4rem)"
  themeColor="#6366f1"
  defaultColorMode="light"
  locale="en-US"
  timeZone="Asia/Kolkata"
  hour12={true}
/>

Query parameters

Attach shared or per-endpoint query strings to package REST calls. Defaults apply queryParams to GET APIs only. Full patterns live in API Integration.

tsx
<ChatMain
  {...chatConfig}
  queryParams={{ tenant: "acme" }}
  queryParamApis={["get"]}
  queryParamsByApi={{
    conversations: { includeArchived: false },
    presignedUrls: { folder: "chat-uploads" },
  }}
/>

Customization props

Use components, classNames, and features together. Deep guides: Customization and Components.

tsx
<ChatMain
  {...chatConfig}
  components={{ Avatar: MyAvatar }}
  classNames={{ messageBubbleSender: "rounded-2xl" }}
  features={{
    showPhoneCall: true,
    onPhoneCall: ({ conversationId }) => startCall(conversationId),
  }}
/>

Layout sections (layout prop)

Toggle parts of the default UI on or off without writing any new components. Spread defaultChatLayoutConfig and flip only the sections you need.

tsx
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
};
tsx
layout={{ input: false }}          // read-only, no composer
layout={{ sidebar: false }}         // hide sidebar, messages only
layout={{ forwardModal: false }}    // disable the forward modal
layout={{ loggedUserDetails: false, channelList: true }}
PreviousPackage structureNextComponents

On this page

Prop referenceCredentials and endpointsViewport, theme, and localeQuery parametersCustomization propsLayout sections (layout prop)