The message type, which must extend IdentifiableMessage.
Optional
alignmentAlignment of the chat list. Determines whether new messages appear at the top or bottom.
Optional
classClass name for the root element of the chat viewer.
Optional
historyOffset in pixels from the end of the history at which to trigger onHistoryEndReached.
Optional
keepMessageIds of messages to keep mounted even when out of view.
Optional
keepIndexes of messages to keep mounted even when out of view. This allows you to preserve the state of messages that are not currently visible.
The array of messages to display in the chat viewer.
Optional
onCallback fired when the viewport reaches the bottom of the message list.
ChatViewerHandle instance. Allows you to control the chat viewer.
Optional
onCallback fired when the viewport reaches the top of the message list.
ChatViewerHandle instance. Allows you to control the chat viewer.
Optional
onCallback fired when the user scrolls to the end of the history (top or bottom, depending on alignment).
ChatViewerHandle instance. Allows you to control the chat viewer.
Optional
onCallback fired on key down events in the scrollable container.
Optional
onCallback fired when newer messages are requested (e.g., user scrolls to the bottom).
You might want to use this callback with utility functions like followEveryMessage, followMessagesAtBottom, or followMessagesBy to automatically scroll to automatically follow new messages.
<ChatViewer
messages={messages}
renderMessage={renderMessage}
onNewerMessages={followMessagesAtBottom()}
/>
ChatViewerHandle instance. Allows you to control the chat viewer.
followMessagesAtBottom - scrolls to the bottom when viewport is at the bottom of the history.
Optional
onCallback fired when older messages are requested (e.g., user scrolls to the top).
ChatViewerHandle instance. Allows you to control the chat viewer.
Optional
onCallback fired when the prefix node is displayed in the viewport.
ChatViewerHandle instance. Allows you to control the chat viewer.
Optional
onCallback fired on scroll with the current scroll offset.
The current scroll offset.
Optional
onCallback fired when scrolling ends.
Optional
onCallback fired when the suffix node is displayed in the viewport.
ChatViewerHandle instance. Allows you to control the chat viewer.
followSuffixAtBottom - scrolls to the bottom when viewport when suffix is displayed at the bottom of the history.
Optional
onCallback fired on wheel events in the scrollable container.
Optional
overscanNumber of extra items to render beyond the visible area (for virtualization performance).
Passed to Virtua's overscan
prop.
Optional
prefixReact node to render before the message list (e.g., a header or history loader). It can be conditionally displayed. When changed, it will trigger a onPrefixDisplay callback.
Function to render a message.
Optional
scrollerClass name for the scrollable container.
Optional
scrollerStyle for the scrollable container.
Optional
ssrNumber of items to render on the server for SSR. Passed to Virtua's ssrCount
prop.
Optional
styleStyle for the root element of the chat viewer.
Optional
suffixReact node to render after the message list (e.g., a footer or typing indicator). It can be conditionally displayed. When changed, it will trigger a onSuffixDisplay callback.
Props for the ChatViewer component.