showcase/shell-docs/src/content/reference/react-native/components/CopilotModal.mdx
Like CopilotChat, CopilotModal ships in two versions, chosen by import path:
@copilotkit/react-native) is a thin wrapper around CopilotChat that mirrors the web SDK's CopilotModal API. It provides agent wiring only; you handle modal presentation with React Native's Modal (or any overlay) and build the chat UI from useCopilotChatContext.@copilotkit/react-native/components) is a ready-made chat in a @gorhom/bottom-sheet with snap points and swipe-to-dismiss. See Prebuilt UI.CopilotModalimport { CopilotModal } from "@copilotkit/react-native";
Accepts all headless CopilotChat props (agentId, agentName, threadId, onError, throttleMs, attachments), plus:
import { CopilotModal } from "@copilotkit/react-native";
import { Modal } from "react-native";
function App({ isOpen }: { isOpen: boolean }) {
return (
<Modal visible={isOpen} animationType="slide">
<CopilotModal agentId="default">
<MyChatUI />
</CopilotModal>
</Modal>
);
}
Import CopilotModal from the /components subpath for a bottom-sheet chat. Control it imperatively through a CopilotModalRef, or declaratively with the visible prop. Requires the @gorhom/bottom-sheet, react-native-gesture-handler, and react-native-reanimated peer dependencies.
import { CopilotModal, type CopilotModalRef } from "@copilotkit/react-native/components";
import { CopilotModal, type CopilotModalRef } from "@copilotkit/react-native/components";
import { useRef } from "react";
import { Button, View } from "react-native";
export function ChatScreen() {
const modalRef = useRef<CopilotModalRef>(null);
return (
<View style={{ flex: 1 }}>
<Button title="Open chat" onPress={() => modalRef.current?.open()} />
<CopilotModal
ref={modalRef}
agentName="default"
headerTitle="Assistant"
snapPoints={["50%", "90%"]}
/>
</View>
);
}
CopilotChat: the underlying chat primitive and prebuilt UICopilotSidebar: slide-in drawer variantCopilotPopup: floating action button + overlay