---
title: "CopilotChatAssistantMessage"
description: "Component for displaying assistant messages with Markdown, tool calls, and an action toolbar"
---
## Overview
`CopilotChatAssistantMessage` displays assistant messages with Markdown support, tool call rendering, and an action toolbar. The Markdown renderer uses `remark-gfm`, `remark-math`, syntax highlighting via `rehype-pretty-code`, and KaTeX support for mathematical expressions. The toolbar provides copy, rating (thumbs up/down), read aloud, and regenerate buttons with localized tooltips sourced from `CopilotChatConfigurationProvider`.
## Import
```tsx
import { CopilotChatAssistantMessage } from "@copilotkit/react-core/v2";
import "@copilotkit/react-core/v2/styles.css";
```
## Props
The assistant message object to render. Contains the message `content`, `id`,
`role`, and any associated tool calls.
The full array of conversation messages. Passed through to the `toolCallsView`
slot for context-aware tool call rendering.
Whether the agent is currently executing. Can be used by slot components to
adjust their behavior during streaming.
Callback invoked when the user clicks the thumbs-up button. When not provided,
the thumbs-up button is hidden from the toolbar.
Callback invoked when the user clicks the thumbs-down button. When not
provided, the thumbs-down button is hidden from the toolbar.
Callback invoked when the user clicks the read-aloud button. When not
provided, the read-aloud button is hidden from the toolbar.
Callback invoked when the user clicks the regenerate button. When not
provided, the regenerate button is hidden from the toolbar.
Additional React elements appended to the toolbar alongside the default action
buttons.
Controls whether the action toolbar is visible. When set to `false`, the
toolbar is hidden entirely regardless of which callback props are provided.
## Slots
All slot props follow the CopilotKit slot system: each accepts a replacement React component, a `className` string that is merged into the default component's classes, or a partial props object that extends the default component.
Slot for the Markdown rendering engine. Defaults to `CopilotChatAssistantMessage.MarkdownRenderer`, which supports GFM tables, math expressions via KaTeX, and syntax-highlighted code blocks via `rehype-pretty-code`.
**As a replacement component:**
```tsx
(
)}
/>
```
Slot for the action toolbar container. Defaults to `CopilotChatAssistantMessage.Toolbar`, which renders a horizontal row of action buttons below the message content.
**As a className:**
```tsx
```
Slot for the copy-to-clipboard button in the toolbar. Defaults to
`CopilotChatAssistantMessage.CopyButton`. The tooltip label is sourced from
`CopilotChatLabels.assistantMessageToolbarCopyMessageLabel`.
Slot for the thumbs-up rating button. Defaults to
`CopilotChatAssistantMessage.ThumbsUpButton`. Only rendered when `onThumbsUp`
is provided. The tooltip label is sourced from
`CopilotChatLabels.assistantMessageToolbarThumbsUpLabel`.
Slot for the thumbs-down rating button. Defaults to
`CopilotChatAssistantMessage.ThumbsDownButton`. Only rendered when
`onThumbsDown` is provided. The tooltip label is sourced from
`CopilotChatLabels.assistantMessageToolbarThumbsDownLabel`.
Slot for the read-aloud button. Defaults to
`CopilotChatAssistantMessage.ReadAloudButton`. Only rendered when
`onReadAloud` is provided. The tooltip label is sourced from
`CopilotChatLabels.assistantMessageToolbarReadAloudLabel`.
Slot for the regenerate button. Defaults to
`CopilotChatAssistantMessage.RegenerateButton`. Only rendered when
`onRegenerate` is provided. The tooltip label is sourced from
`CopilotChatLabels.assistantMessageToolbarRegenerateLabel`.
Slot for rendering tool calls embedded in the assistant message. Defaults to
[`CopilotChatToolCallsView`](#copilotchattoolcallsview), which iterates over
the message's tool calls and renders each using the closest registered tool
renderer.
## CopilotChatToolCallsView
A companion component that renders the tool calls contained in an assistant message. Given an assistant message, it iterates over each tool call and renders it using the closest registered tool renderer (registered via `useFrontendTool`, `useHumanInTheLoop`, or `renderToolCalls` on the provider).
### Import
```tsx
```
### Props
The assistant message whose tool calls should be rendered.
The full conversation message array. Provides context for tool call renderers
that need to reference other messages (e.g., to find the corresponding tool
result message).
## Usage
### Basic Assistant Message
```tsx
function AssistantBubble({ message }) {
return (
console.log("Thumbs up:", msg.id)}
onThumbsDown={(msg) => console.log("Thumbs down:", msg.id)}
/>
);
}
```
### Customizing the Toolbar
```tsx
function CustomToolbarMessage({ message }) {
return (
handleRegenerate(msg)}
onReadAloud={(msg) => speak(msg.content)}
additionalToolbarItems={
}
toolbar="border-t border-gray-200 pt-2"
/>
);
}
```
### Hiding the Toolbar
```tsx
function MinimalMessage({ message }) {
return (
);
}
```
### Custom Markdown Renderer
```tsx
function CustomRendererMessage({ message }) {
return (
(
{content}
)}
/>
);
}
```
### Standalone Tool Calls View
```tsx
function ToolCallsList({ message, allMessages }) {
return (
);
}
```
## Behavior
- **Markdown Support**: The default Markdown renderer supports GitHub Flavored Markdown (tables, strikethrough, task lists), math expressions rendered with KaTeX, and syntax-highlighted code blocks via `rehype-pretty-code`.
- **Toolbar Visibility**: The toolbar appears on hover or focus by default. Individual buttons are only rendered when their corresponding callback prop (`onThumbsUp`, `onThumbsDown`, `onReadAloud`, `onRegenerate`) is provided. The copy button is always visible when the toolbar is shown.
- **Localized Labels**: All toolbar button tooltips are sourced from the nearest `CopilotChatConfigurationProvider`. See [`useCopilotChatConfiguration`](/reference/hooks/useCopilotChatConfiguration) for the full list of label keys.
- **Tool Call Rendering**: Tool calls embedded in the assistant message are rendered by the `toolCallsView` slot. Each tool call is resolved using the `useRenderToolCall` hook, which looks up registered renderers by tool name.
- **Slot System**: Each slot prop accepts three forms -- a replacement component, a className string merged into the default, or a partial props object that extends the default component's props.
## Related
- [`CopilotChatMessageView`](/reference/components/CopilotChatMessageView) -- Parent component that uses this as the default assistant message slot
- [`CopilotChatUserMessage`](/reference/components/CopilotChatUserMessage) -- Companion component for user messages
- [`useRenderToolCall`](/reference/hooks/useRenderToolCall) -- Hook used internally for resolving tool call renderers
- [`useCopilotChatConfiguration`](/reference/hooks/useCopilotChatConfiguration) -- Provider for localized toolbar labels