---
title: "CopilotPopup"
description: "Popup variant of CopilotChat that renders in a floating panel with a toggle button"
---
## Overview
`CopilotPopup` renders a floating chat popup with a toggle button. It wraps [`CopilotChat`](/reference/components/CopilotChat) and provides popup-specific layout, sizing, and open/close behavior. The popup includes a header with a title and close button, and can be dismissed by clicking outside.
See [`CopilotSidebar`](/reference/components/CopilotSidebar) for a sidebar variant of this component.
## Import
```tsx
import { CopilotPopup } from "@copilotkit/react-core/v2";
import "@copilotkit/react-core/v2/styles.css";
```
## Props
### Own Props
Slot override for the popup header. Accepts a replacement component, a
`className` string merged into the default, or a partial props object. The
default header displays a title and a close button.
Whether the popup should be open when the component first mounts.
Width of the popup panel. Accepts a number (pixels) or a CSS string (e.g.
`"400px"`, `"30vw"`).
Height of the popup panel. Accepts a number (pixels) or a CSS string (e.g.
`"600px"`, `"80vh"`).
Whether clicking outside the popup panel closes it.
### Inherited CopilotChat Props
`CopilotPopup` accepts all props from [`CopilotChatProps`](/reference/components/CopilotChat) **except** `chatView`, which is set internally to `CopilotPopupView`. This includes:
ID of the agent to use. Must match an agent configured in
`CopilotKit`.
ID of the conversation thread.
Partial label overrides for all text strings rendered inside the chat.
Whether the chat scrolls to the bottom automatically when new messages arrive.
Additional props forwarded to the inner `CopilotChatInput` component.
Controls the welcome screen shown when no messages exist.
All `CopilotChatView` slot props (`messageView`, `input`, `scrollView`, `inputContainer`, `feather`, `disclaimer`, `suggestionView`) are also accepted and forwarded through.
## Slot System
All slot props follow the same override pattern used across CopilotKit v2 components. Each slot accepts one of three value types:
| Value | Behavior |
| ------------------------ | ----------------------------------------------------------------------------------- |
| **Component** | Replaces the default component entirely. Receives the same props the default would. |
| **`className` string** | Merged into the default component's class list via `twMerge`. |
| **Partial props object** | Spread into the default component as additional or overriding props. |
## Usage
### Basic Usage
```tsx
function App() {
return (
);
}
```
### Custom Size and Default Open
```tsx
function App() {
return (
);
}
```
### Custom Header
```tsx
function App() {
return ;
}
```
## Behavior
- **Toggle button**: Renders a floating toggle button (typically in the bottom-right corner) that opens and closes the popup. The button uses `CopilotChatToggleButton` internally.
- **Modal state**: Open/close state is managed via the chat configuration context. The `defaultOpen` prop sets the initial state; after that, state changes come from user interaction (toggle button, close button, clicking outside).
- **Click outside**: When `clickOutsideToClose` is `true` (the default), clicking anywhere outside the popup panel closes it.
- **Layout**: The popup uses `CopilotPopupView` internally, which provides a popup-specific welcome screen layout with the welcome message centered vertically and suggestions just above the input.
- **Agent connection**: All agent wiring (messages, running state, suggestions) is handled by the parent `CopilotChat` logic.
## Related
- [`CopilotChat`](/reference/components/CopilotChat) -- the base chat component used internally
- [`CopilotSidebar`](/reference/components/CopilotSidebar) -- sidebar variant
- [`CopilotChatView`](/reference/components/CopilotChatView) -- the layout component used internally