Skip to contentSkip to content

MessageListRoot API

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

Demos

Import

import { MessageListRoot } from '@mui/x-chat-headless/message-list';
// or
import { MessageListRoot } from '@mui/x-chat-headless';
// or
import { MessageListRoot } 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.

    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

        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.