RealTimeX
Sign inStart for free
RealTimeXWeb Package
IntroductionPrerequisitesInstallationProject setupQuick start
Package structureConfigurationComponentsHooksAPI integrationSocket events
OverviewReplace entire UIReplace componentsStyle with classNamesThemes & localePhone & video callingIn-call control barFeatures
Unread badgeRich-text messagesPins, stars & datesMessage threadsMentionsCanvas & draftsNotificationsAdmin permissionsServer refusalsSession & token refresh
Host app integrationTroubleshootingFAQVersion historyBest practicesSupport & contact
Web packageBuilt-in features

Rich text (Lexical)

The composer and formatted message bubbles use Lexical - bundled, nothing to install.

Installation - host app

WhoWhat to install
Your app (Elstar, Vite, Next.js, …)@realtimexsco/live-chat + peers only (react, react-dom)
Lexical in your app's package.jsonNothing - bundled inside @realtimexsco/live-chat
The npm package itself (maintainers)lexical, @lexical/*, dompurify in dependencies

Don't add lexical or @lexical/*to your package.json unless you build your own editor outside this package. Confirm it's present after install:

shell
npm ls lexical @lexical/react dompurify

Bundled Lexical packages

PackageUsed for
lexicalCore editor API
@lexical/reactLexicalComposer, plugins, hooks
@lexical/rich-textHeadings, quotes
@lexical/listBullet / numbered lists
@lexical/linkLinks
@lexical/codeInline and block code
@lexical/htmlHTML export/import ($generateHtmlFromNodes, $generateNodesFromDOM)
@lexical/markdownOptional markdown source mode in the composer
@lexical/selectionBlock-type toolbar commands
@lexical/utilsNode helpers
dompurifySanitize HTML before send / display

How formatted messages are stored

The backend persists one field: content.

  • Plain messages → plain text in content
  • Formatted messages → sanitized HTML in content (no extra contentHtml key)

Display uses MessageLexicalViewer: the HTML is imported into a read-only Lexical editor sharing the composer's theme and nodes, so formatting comes from Lexical theme classes, not hand-written CSS.

Note

No bold, lists or mentions? Make sure @realtimexsco/live-chat/styles.css is imported - the Lexical theme classes live there.

Exports for custom UI

tsx
1import {2  ComposerLexicalEditor,3  MessageLexicalViewer,4  type ComposerLexicalEditorHandle,5  type MessageLexicalViewerProps,6} from "@realtimexsco/live-chat";

Use MessageLexicalViewer in a custom MessageItem slot to keep Lexical-accurate rendering:

tsx
<MessageLexicalViewer html={messageHtml} messageId={message.id} />
PreviousUnread badgeNextPins, stars & dates

On this page

Installation - host appBundled Lexical packagesHow formatted messages are storedExports for custom UI
Back to top