Skip to contentSkip to content

ChatMessageList API

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

Demos

Import

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

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

Props

NameTypeDefaultDescription
renderItem*func-
Signature:function(params: { id: string; index: number; }) => ReactNode
    autoScrollbool
    | bool
    | { buffer?: number }
    true

    Controls automatic scrolling to the bottom when new messages arrive or streaming content grows, as long as the user is within buffer pixels of the bottom.

    - true – enable with the default buffer (150 px). - { buffer: number } – enable with a custom threshold. - false – disable (the scroll-to-bottom affordance is still available).

    Scrolling when the *user* sends a message is always active.

    classesPartial-

    See CSS classes API below for more details.

    estimatedItemSizenumber-
    getItemKeyfunc-
    Signature:function(id: string, index: number) => Key
      itemsArray<string>-
      onReachTopfunc-
      Signature:function() => void
        overlaynode-
        slotPropsMessageListRootSlotProps-
        slotsPartial-

        See Slots API below for more details.

        The component cannot hold a ref.

        Slots

        Slot nameClass nameDefault componentDescription
        messageList
        messageListContent
        messageListOverlay
        messageListScrollbar
        messageListScrollbarThumb
        messageListScroller

        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
        .MuiChatMessageList-contentcontentStyles applied to the message list content element.
        .MuiChatMessageList-rootrootStyles applied to the message list root element.
        .MuiChatMessageList-scrollerscrollerStyles applied to the message list scroller 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.