<Tabs groupId="component" items={["CopilotPopup", "CopilotSidebar", "CopilotChat", "Headless UI"]}>
`CopilotPopup` is a convenience wrapper for `CopilotChat` that lives at the same level as your main content in the view hierarchy. It provides **a floating chat interface** that can be toggled on and off.
<img src="/images/popup-example.gif" alt="Popup Example" className="w-full rounded-lg my-4" />
```tsx
// [!code word:CopilotPopup]
import { CopilotPopup } from "@copilotkit/react-ui";
export function YourApp() {
return (
<>
<YourMainContent />
<CopilotPopup
instructions={"You are assisting the user as best as you can. Answer in the best way possible given the data you have."}
labels={{
title: "Popup Assistant",
initial: "Need any help?",
}}
/>
</>
);
}
```
<img src="/images/sidebar-example.gif" alt="Popup Example" className="w-full rounded-lg my-4" />
```tsx
// [!code word:CopilotSidebar]
import { CopilotSidebar } from "@copilotkit/react-ui";
export function YourApp() {
return (
<CopilotSidebar
defaultOpen={true}
instructions={"You are assisting the user as best as you can. Answer in the best way possible given the data you have."}
labels={{
title: "Sidebar Assistant",
initial: "How can I help you today?",
}}
>
<YourMainContent />
</CopilotSidebar>
);
}
```
<img src="/images/copilotchat-example.gif" alt="Popup Example" className="w-full rounded-lg my-4" />
```tsx
// [!code word:CopilotChat]
import { CopilotChat } from "@copilotkit/react-ui";
export function YourComponent() {
return (
<CopilotChat
instructions={"You are assisting the user as best as you can. Answer in the best way possible given the data you have."}
labels={{
title: "Your Assistant",
initial: "Hi! 👋 How can I assist you today?",
}}
/>
);
}
```
CopilotKit also offers **fully custom headless UI**, through the `useCopilotChat` hook. Everything built with the built-in UI (and more) can be implemented with the headless UI, providing deep customizability.
```tsx
import { useCopilotChat } from "@copilotkit/react-core";
import { Role, TextMessage } from "@copilotkit/runtime-client-gql";
export function CustomChatInterface() {
const {
visibleMessages,
appendMessage,
setMessages,
deleteMessage,
reloadMessages,
stopGeneration,
isLoading,
} = useCopilotChat();
const sendMessage = (content: string) => {
appendMessage(new TextMessage({ content, role: Role.User }));
};
return (
<div>
{/* Implement your custom chat UI here */}
</div>
);
}
```