---
title: "<CopilotPopup />"
description: "A chatbot popup component for CopilotKit."
---

<img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=a9b290bb-38f9-4518-ac3b-8f54fdbf43be" />

A chatbot popup component for the CopilotKit framework. The component allows for a high degree
of customization through various props and custom CSS.

See [CopilotSidebar](./CopilotSidebar) for a sidebar version of this component.

<RequestExample>
  ```jsx CopilotPopup Example
  import { CopilotPopup } from "@copilotkit/react-ui";

  <CopilotPopup
    labels={{
      title: "Your Assistant",
      initial: "Hi! 👋 How can I assist you today?",
    }}
  />
  ```
</RequestExample>

## Custom CSS

You can customize the colors of the chat window by overriding the CSS variables
defined in the [default styles](https://github.com/CopilotKit/CopilotKit/blob/main/CopilotKit/packages/react-ui/src/css/colors.css).

For example, to set the primary color to purple:

```jsx
<div style={{ "--copilot-kit-primary-color": "#7D5BA6" }}>
  <CopilotPopup />
</div>
```

To further customize the chat window, you can override the CSS classes defined
[here](https://github.com/CopilotKit/CopilotKit/blob/main/CopilotKit/packages/react-ui/src/css/).

For example:

```css
.copilotKitButton {
  border-radius: 0;
}
```

## Props

<ResponseField name="instructions" type="string">
  Custom instructions to be added to the system message. Use this property to
  provide additional context or guidance to the language model, influencing its
  responses. These instructions can include specific directions, preferences, or
  criteria that the model should consider when generating its output, thereby
  tailoring the conversation more precisely to the user's needs or the
  application's requirements.
</ResponseField>

<ResponseField name="defaultOpen" type="boolean" default="false">
  Whether the chat window should be open by default.
</ResponseField>

<ResponseField name="clickOutsideToClose" type="boolean" default="true">
  If the chat window should close when the user clicks outside of it.
</ResponseField>

<ResponseField name="hitEscapeToClose" type="boolean" default="true">
  If the chat window should close when the user hits the Escape key.
</ResponseField>

<ResponseField name="onSetOpen" type="function">
  A callback `(open: boolean) => void` that gets called when the chat window
  opens or closes.
</ResponseField>

<ResponseField name="shortcut" type="string" default="e">
  The shortcut key to open the chat window. Uses Command-`shortcut` on a Mac and
  Ctrl-`shortcut` on Windows.
</ResponseField>

<ResponseField name="icons" type="CopilotChatIcons">
  `icons` can be used to set custom icons for the chat window.
</ResponseField>

<ResponseField name="labels" type="CopilotChatLabels">
  `labels` can be used to set custom labels for the chat window.
  <Expandable title="CopilotChatLabels">

    <ResponseField name="initial" type="string | string[]">
      The initial message(s) to display in the chat window.
    </ResponseField>

    <ResponseField name="title" type="string" default="CopilotKit">
      The title to display in the header.
    </ResponseField>

    <ResponseField name="placeholder" type="string" default="Type a message...">
      The placeholder to display in the input.
    </ResponseField>

    <ResponseField name="thinking" type="string" default="Thinking...">
      The message to display while the assistant is "thinking".
    </ResponseField>

    <ResponseField name="error" type="string" default="❌ An error occurred. Please try again.">
      The message to display when an error occurs.
    </ResponseField>

    <ResponseField name="stopGenerating" type="string" default="Stop generating">
      The label to display on the stop button.
    </ResponseField>

    <ResponseField name="regenerateResponse" type="string" default="Regenerate response">
      The label to display on the regenerate button.
    </ResponseField>

  </Expandable>
</ResponseField>

<ResponseField name="makeSystemMessage" type="SystemMessageFunction">
  A function `(contextString: string, additionalInstructions?: string) =>
  string` that takes in context string and instructions and returns the system
  message to include in the chat request. Use this to completely override the
  system message, when providing instructions is not enough.
</ResponseField>

<ResponseField name="showResponseButton" type="boolean" default="true">
  Whether to show the response button.
</ResponseField>

<ResponseField name="className" type="string">
  A class name to apply to the root element.
</ResponseField>

<ResponseField name="Window" type="React.ComponentType<WindowProps>">
  A custom Window component to use instead of the default.
</ResponseField>

<ResponseField name="Button" type="React.ComponentType<ButtonProps>">
  A custom Button component to use instead of the default.
</ResponseField>

<ResponseField name="Header" type="React.ComponentType<HeaderProps>">
  A custom Header component to use instead of the default.
</ResponseField>

<ResponseField name="Messages" type="React.ComponentType<MessagesProps>">
  A custom Messages component to use instead of the default.
</ResponseField>

<ResponseField name="Input" type="React.ComponentType<InputProps>">
  A custom Input component to use instead of the default.
</ResponseField>

<ResponseField
  name="ResponseButton"
  type="React.ComponentType<ResponseButtonProps>"
>
  A custom ResponseButton component to use instead of the default.
</ResponseField>
