Skip to content
+

Chat — Material UI examples

Build chat interfaces with @mui/x-chat using ready-made ChatBox demos.

Each demo shows a common product pattern with ChatBox and focuses on one aspect of the @mui/x-chat API.

All examples use a local echo adapter that streams responses back; replace it with your adapter to connect a backend.

Where to start

Composable parts

  • Message feed — a display-only embed with no input—trigger messages via useChat().sendMessage().
  • Split layout — place ChatMessageList and ChatComposer in separate DOM zones, connected only by ChatRoot.

Agentic

  • Agentic code assistant — streaming tool calls (Bash, Read, Edit, Write, Glob), reasoning parts, step boundaries, and an interactive tool-approval flow—all via the adapter API.
  • Plan & task — display a structured agent execution plan with live step status via ChatTaskList and ChatTask.
  • Code block — display code with a language label and copy-to-clipboard via ChatCodeBlock.
  • Confirmation — human-in-the-loop checkpoints before irreversible actions via ChatConfirmation.

Theming and customization

  • Compact variant — a messenger-style layout with no bubbles, left-aligned messages, and author names as group headers.
  • Custom theme — change palette, shape, and typography via ThemeProvider.
  • Slot overrides — replace inner subcomponents with custom implementations.
  • Model selector — add a model picker to the conversation header via slots.conversationHeaderActions.

Suggested learning order

  1. Start with Basic AI chat for the minimal surface.
  2. Try Thread-only for a copilot with no conversation sidebar.
  3. Move to Multi-conversation to see the two-pane inbox pattern.
  4. Explore Custom theme to retheme the component from the ThemeProvider.
  5. Finish with Slot overrides when the default structure needs modification.

API