Skip to contentSkip to content

ChatMessageSource API

API reference docs for the React ChatMessageSource component. Learn about the props, CSS, and other APIs of this exported module.

Demos

Import

import { ChatMessageSource } from '@mui/x-chat/ChatMessageSources';
// or
import { ChatMessageSource } from '@mui/x-chat';

Learn about the difference by reading this guide on minimizing bundle size.

Props

NameTypeDescription
href*string

The URL this source links to.

classesPartial

See CSS classes API below for more details.

indexnumber

1-based position number displayed as a muted badge.

slotPropsChatMessageSourceSlotProps
slotsChatMessageSourceSlots

See Slots API below for more details.

titlestring

Display title for the source. Falls back to href when omitted.

The component cannot hold a ref.

Slots

Slot nameClass nameDefault componentDescription
index.MuiChatMessageSource-index'span'The numeric index badge.
root.MuiChatMessageSource-root'li'The root list item element.

CSS classes

These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.

Class nameRule nameDescription
.MuiChatMessageSource-indexindexStyles applied to the index badge element.
.MuiChatMessageSource-rootrootStyles applied to the root element.

You can override the style of the component using one of these customization options:

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.