Skip to content
+

Chat - ChatBox

Render a complete chat surface with a single import.

ChatBox is the fastest way to add a chat interface to your application. It creates a ChatProvider internally and composes the themed header, message list, and composer into a ready-to-use surface. Enable the built-in conversation list explicitly when you want inbox-style navigation. ChatBox ships full keyboard navigation and screen-reader support out of the box—see Accessibility.

Interactive playground

Try the ChatBox props live—toggle variant, density, layout mode, and the built-in features:

ChatBox
Full chat surface — conversation list, header, message list, composer, suggestions, and affordances.

Styling questions

How do I theme MuiChatComposer?

Appearance
variantenum · 2
densityenum · 3
layoutModeenum · 3
features
conversationList
conversationHeader
attachments
suggestions
scrollToBottom
Floating jump-to-latest affordance.
helperText
Hint row below the composer.
autoScroll
Stick to the bottom on new messages.
Suggestions
suggestionsAutoSubmit
Submit on click instead of populating the input.
Copy JSX with your current props and overrides.

The playground starts with features.conversationList enabled to showcase the full surface; on ChatBox itself the conversation list is off by default.

The layoutMode prop controls the responsive arrangement: standard shows the conversation list and thread side by side, overlay presents the list as a slide-in panel, and split shows one pane at a time with back navigation. When omitted, ChatBox picks the mode automatically from its container width using layoutModeBreakpoints (defaults: overlay: 600, split: 450). See Layout for composing custom arrangements.

In its minimal form, ChatBox needs only an adapter and a height—everything else has defaults. Add features.conversationList when you want inbox-style navigation:

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

<ChatBox adapter={adapter} sx={{ height: 500 }} />;
<ChatBox
  adapter={adapter}
  features={{ conversationList: true }}
  sx={{ height: 500 }}
/>;

All visual styles derive from the active Material UI theme. No additional configuration is needed—ChatBox reads palette, typography, shape, and spacing from the closest ThemeProvider.

The demo below shows ChatBox picking up the active Material UI theme:

Material UI chat

Styled with your active MUI theme

MUI Assistant
MUI Assistant

Hello! I am styled using your active Material UI theme. Try sending a message.

You
You

Great — the bubble colors come from palette.primary and the typography from the theme.

ChatBox vs. ChatProvider

Using ChatBox for an all-in-one surface

ChatBox is the right choice when you want a complete chat surface with minimal setup. It creates a ChatProvider internally, so all hooks work inside any component rendered as a child or descendant of ChatBox:

Material UI chat

Styled with your active MUI theme

MUI Assistant
MUI Assistant

Hello! I am styled using your active Material UI theme. Try sending a message.

You
You

Great — the bubble colors come from palette.primary and the typography from the theme.

Using ChatProvider for a custom layout

When you need full control over the markup, use ChatProvider directly and compose only the pieces you need—here, just the message list and a composer:

MUI Assistant
MUI Assistant

This layout is built with ChatProvider directly. The message list and composer are composed manually.

You
You

So I get full control over what is rendered?

MUI Assistant
MUI Assistant

Exactly. You pick only the pieces you need and arrange them however you like.

The same approach scales up to a full inbox layout—a conversation list in a sidebar next to the active thread. See the Layout page for the building blocks:

MUI Assistant
Component questions
Which component handles the composer?
2
MUI Assistant
Theme customization
How do I override the bubble color?
MUI Assistant
Slot overrides
Replacing the send button slot
Component questions

Which component handles the composer?

Alice Chen
Alice Chen

Which component should I use for the message input area?

MUI Assistant
MUI Assistant

The composer is handled by the ChatBox automatically. You can override it with slots.composer.

Alice Chen
Alice Chen

And what about slotProps for passing sx to the input?

Feature flags

Everything you saw in the all-in-one surface above is governed by the features prop, which toggles built-in capabilities on or off:

<ChatBox
  adapter={adapter}
  features={{
    conversationList: true, // show the conversation sidebar / drawer (default false)
    conversationHeader: true, // show the title, subtitle, and actions bar (default true)
    dateDivider: true, // show date separators between calendar days (default false)
    unreadMarker: true, // show the "new messages" marker (default false)
    attachments: false, // disable attachment functionality (default true)
    helperText: false, // hide the helper text below the composer (default true)
    scrollToBottom: false, // disable the scroll-to-bottom affordance (default true)
    autoScroll: { buffer: 300 }, // custom auto-scroll threshold (default true)
    suggestions: false, // hide prompt suggestions in the empty state (default true)
  }}
/>

The demo below enables dateDivider and unreadMarker—the divider marks the day boundary and the marker sits above the first unread message:

Feature flags

dateDivider + unreadMarker enabled

You
You

Can you summarize yesterday's release notes?

MUI Assistant
MUI Assistant

Sure — the release shipped roving focus, landmarks, and a streaming announcer.

You
You

Great, thanks!

MUI Assistant
MUI Assistant

Morning! A new beta is out with the feature flags documented here.

Toggle dateDivider and unreadMarker to see the separators above.

The conversationList, dateDivider, and unreadMarker flags each have a dedicated page: Conversation list, Date divider, and Unread marker.

Feature flags let you progressively enable functionality without replacing slots or restructuring the component tree.

Controlled and uncontrolled state

ChatBox supports both controlled and uncontrolled patterns for every piece of state. These props are forwarded to the internal ChatProvider. See Controlled state for the full pattern reference.

Messages

{
  /* Uncontrolled — internal store owns the messages */
}
<ChatBox adapter={adapter} initialMessages={initialMessages} />;

{
  /* Controlled — you own the messages array */
}
<ChatBox adapter={adapter} messages={messages} onMessagesChange={setMessages} />;

Conversations

{
  /* Uncontrolled */
}
<ChatBox
  adapter={adapter}
  initialConversations={conversations}
  initialActiveConversationId="conv-1"
  features={{ conversationList: true }}
/>;

{
  /* Controlled */
}
<ChatBox
  adapter={adapter}
  conversations={conversations}
  onConversationsChange={setConversations}
  activeConversationId={activeId}
  onActiveConversationChange={setActiveId}
  features={{ conversationList: true }}
/>;

Composer value

{
  /* Uncontrolled */
}
<ChatBox adapter={adapter} initialComposerValue="Hello" />;

{
  /* Controlled */
}
<ChatBox
  adapter={adapter}
  composerValue={composerValue}
  onComposerValueChange={setComposerValue}
/>;

Mix controlled and uncontrolled state freely. For example, control the active conversation while letting the internal store manage messages.

Multiple independent instances

Each ChatBox creates its own isolated store. To render multiple independent chat surfaces side by side, use separate ChatBox instances:

Support
You
You

My order #1042 hasn't arrived.

Support Bot
Support Bot

Support received: "My order #1042 hasn't arrived.". How else can I help?

Sales
You
You

Do you offer team licenses?

Sales Bot
Sales Bot

Sales received: "Do you offer team licenses?". Let me check our catalog.

API

See the documentation below for a complete reference to all of the props and classes available to the components mentioned here.