showcase/shell-docs/src/content/reference/react-native/components/CopilotSidebar.mdx
CopilotSidebar renders a slide-in drawer from the right edge of the screen, with a header bar, a backdrop, and an optional floating action button (FAB) to toggle it. The drawer's chat area wraps a headless CopilotChat. Render your chat UI as children (consuming useCopilotChatContext) or drop in the prebuilt UI CopilotChat from @copilotkit/react-native/components.
Control it imperatively through a CopilotSidebarHandle ref.
import { CopilotSidebar, type CopilotSidebarHandle } from "@copilotkit/react-native";
Accepts the headless CopilotChat props (agentId, agentName, threadId, onError, throttleMs, attachments) except children is repurposed for the drawer body, plus:
import { CopilotSidebar, type CopilotSidebarHandle } from "@copilotkit/react-native";
import { CopilotChat } from "@copilotkit/react-native/components";
import { useRef } from "react";
export function ChatScreen() {
const sidebarRef = useRef<CopilotSidebarHandle>(null);
return (
<CopilotSidebar ref={sidebarRef} agentId="default" headerTitle="Assistant">
<CopilotChat agentName="default" showHeader={false} />
</CopilotSidebar>
);
}
Animated API.showToggleButton is true, a floating button opens the drawer and hides while it is open.CopilotPopup: floating action button plus centered overlayCopilotChat: the chat primitive wrapped inside the drawer