ChatMessageGroup API
API reference docs for the React ChatMessageGroup component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import { ChatMessageGroup } from '@mui/x-chat/ChatMessage';
// or
import { ChatMessageGroup } from '@mui/x-chat';Learn about the difference by reading this guide on minimizing bundle size.
Props of the native component are also available.
| Name | Type | Default | Description |
|---|---|---|---|
| groupKey | func | (message) => message.author?.id ?? message.role ?? '' | A function that maps a message to a group key. Messages that resolve to the same key are visually grouped (shared avatar, author name, etc.). Use |
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
| Class name | Rule name | Description |
|---|---|---|
| .Mui-error | Applied when the message has an error status | |
| .MuiChatMessageGroup-actions | actions | Styles applied to the message actions element. |
| .MuiChatMessageGroup-authorLabel | authorLabel | Styles applied to the message author label element. |
| .MuiChatMessageGroup-avatar | avatar | Styles applied to the message avatar element. |
| .MuiChatMessageGroup-bubble | bubble | Styles applied to the message bubble element inside content. |
| .MuiChatMessageGroup-content | content | Styles applied to the message content element. |
| .MuiChatMessageGroup-dateDivider | dateDivider | Styles applied to the date divider element. |
| .MuiChatMessageGroup-group | group | Styles applied to the message group element. |
| .MuiChatMessageGroup-groupAuthorName | groupAuthorName | Class applied to the group author name element. |
| .MuiChatMessageGroup-groupTimestamp | groupTimestamp | Class applied to the group timestamp element (compact variant only). |
| .MuiChatMessageGroup-inlineMeta | inlineMeta | Styles applied to the inline meta container element (default variant). |
| .MuiChatMessageGroup-inlineMetaSpacer | inlineMetaSpacer | Styles applied to the inline meta spacer element (default variant). |
| .MuiChatMessageGroup-meta | meta | Styles applied to the message meta element. |
| .MuiChatMessageGroup-roleAssistant | roleAssistant | Applied when the message role is 'assistant' |
| .MuiChatMessageGroup-roleUser | roleUser | Applied when the message role is 'user' |
| .MuiChatMessageGroup-root | root | Styles applied to the message root element. |
| .MuiChatMessageGroup-streaming | streaming | Applied while the message is streaming |
You can override the style of the component using one of these customization options:
- With a global class name.
- With a rule name as part of the component's
styleOverridesproperty in a custom theme.
Source code
If you did not find the information in this page, consider having a look at the implementation of the component for more detail.