forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCopilotModal.tsx
More file actions
32 lines (30 loc) · 990 Bytes
/
Copy pathCopilotModal.tsx
File metadata and controls
32 lines (30 loc) · 990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React, { type ReactNode } from "react";
import { CopilotChat, type CopilotChatProps } from "./CopilotChat";
export interface CopilotModalProps extends CopilotChatProps {
/**
* Optional children rendered inside the modal context.
*/
children?: ReactNode;
}
/**
* Headless CopilotModal component for React Native.
*
* A thin wrapper around CopilotChat that mirrors the web SDK's CopilotModal
* API surface. On React Native, modal presentation is handled by the consumer
* (e.g. React Native's `Modal` component) -- this component only provides
* the agent wiring and prop resolution.
*
* ```tsx
* import { CopilotModal } from "@copilotkit/react-native";
* import { Modal } from "react-native";
*
* <Modal visible={isOpen}>
* <CopilotModal agentId="my-agent">
* <MyChatUI />
* </CopilotModal>
* </Modal>
* ```
*/
export function CopilotModal({ children, ...props }: CopilotModalProps) {
return <CopilotChat {...props}>{children}</CopilotChat>;
}