Rich text (Lexical)
The composer and formatted message bubbles use Lexical - bundled, nothing to install.
Installation - host app
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 dompurifyBundled Lexical packages
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.
Exports for custom UI
tsx
import { ComposerLexicalEditor, MessageLexicalViewer, type ComposerLexicalEditorHandle, type MessageLexicalViewerProps,} from "@realtimexsco/live-chat";Use MessageLexicalViewer in a custom MessageItem slot to keep Lexical-accurate rendering:
tsx
<MessageLexicalViewer html={messageHtml} messageId={message.id} />