Skip to contentSkip to content

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

Props of the native component are also available.

NameTypeDefaultDescription
afterContentnode-

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 slots and slotProps to individual part type renderers.

resolveBuiltInPartRendererfunc-

Callback to resolve a built-in part renderer for a given part type.

Signature:function(part: ChatMessagePart, localeText: ChatLocaleText) => ChatPartRenderer<ChatMessagePart> | null
  • part The message part to resolve a renderer for.
  • localeText The locale text for the chat.
slotPropsobject{}

The props used for each component slot.

slotsobject{}

Overridable component slots.

See Slots API below for more details.

The component cannot hold a ref.

Slots

Slot nameClass nameDefault componentDescription
contentThe component that renders the content.
bubbleThe 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.