ChatMessageContent API
API reference docs for the React ChatMessageContent component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import { ChatMessageContent } from '@mui/x-chat/ChatMessage';
// or
import { ChatMessageContent } 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 |
|---|---|---|---|
| afterContent | node | - | Content rendered inside the bubble after the message parts. Useful for placing inline metadata (e.g. timestamp, status) inside the bubble. |
| partProps | { dynamic-tool?: { className?: string, defaultExpanded?: object, slotProps?: object, slots?: object, toolSlotProps?: object, toolSlots?: object }, file?: { className?: string, slotProps?: object, slots?: object }, reasoning?: { className?: string, slotProps?: object, slots?: object }, source-document?: { className?: string, slotProps?: object, slots?: object }, source-url?: { className?: string, slotProps?: object, slots?: object }, text?: { renderText?: func }, tool?: { className?: string, defaultExpanded?: object, slotProps?: object, slots?: object, toolSlotProps?: object, toolSlots?: object } } | - | Props forwarded to the built-in unstyled part renderer components. Use this to pass |
| resolveBuiltInPartRenderer | func | - | Callback to resolve a built-in part renderer for a given part type. Signature: function(part: ChatMessagePart, localeText: ChatLocaleText) => ChatPartRenderer<ChatMessagePart> | null
|
| slotProps | object | {} | The props used for each component slot. |
| slots | object | {} | Overridable component slots. See Slots API below for more details. |
| Slot name | Class name | Default component | Description |
|---|---|---|---|
| content | The component that renders the content. | ||
| bubble | The component that renders the bubble. |
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.