import { PropertyReference, LinkToCopilotCloud } from "@/components";

import { Tabs } from "nextra/components";

import { Callout } from "nextra/components";

# `<CopilotPopup />`

<br/>
<img src="/images/CopilotPopup.gif" width="500" />
 
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](/reference/components/CopilotSidebar) for a sidebar version of this component.
 
## Install Dependencies
 
This component is part of the [@copilotkit/react-ui](https://npmjs.com/package/@copilotkit/react-ui) package.
 
```shell npm2yarn \"@copilotkit/react-ui"\
npm install @copilotkit/react-core @copilotkit/react-ui
```
## Usage
 
```tsx
import { CopilotPopup } from "@copilotkit/react-ui";
import "@copilotkit/react-ui/styles.css";
 
<CopilotPopup
  labels={{
    title: "Your Assistant",
    initial: "Hi! 👋 How can I assist you today?",
  }}
/>
```
 
### Look & Feel
 
By default, CopilotKit components do not have any styles. You can import CopilotKit's stylesheet at the root of your project:
```tsx fileName="YourRootComponent.tsx" {2}
...
import "@copilotkit/react-ui/styles.css";
 
export function YourRootComponent() {
  return (
    <CopilotKit>
      ...
    </CopilotKit>
  );
}
```
For more information about how to customize the styles, check out the [Customize Look & Feel](/concepts/customize-look-and-feel) guide.

## Properties

<PropertyReference 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.
</PropertyReference>

<PropertyReference name="onInProgress" type="(inProgress: boolean) => void"  > 
A callback that gets called when the in progress state changes.
</PropertyReference>

<PropertyReference name="onSubmitMessage" type="(message: string) => void | Promise<void>"  > 
A callback that gets called when a new message it submitted.
</PropertyReference>

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

<PropertyReference name="labels" type="CopilotChatLabels"  > 
Labels can be used to set custom labels for the chat window.
</PropertyReference>

<PropertyReference name="makeSystemMessage" type="SystemMessageFunction"  > 
A function 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.
</PropertyReference>

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

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

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

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

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

<PropertyReference name="children" type="React.ReactNode"  > 
Children to render.
</PropertyReference>

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

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

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

<PropertyReference name="shortcut" type="string"  default="'/'"> 
The shortcut key to open the chat window.
  Uses Command-[shortcut] on a Mac and Ctrl-[shortcut] on Windows.
</PropertyReference>

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

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

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

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

