This solution has been AI generated
Your custom input component needs to match the new v2 slot props. In v2, props like inProgress and onSend were renamed. Replace them with isRunning and onSubmitMessage, and wire value/onChange for the input state.
v2 input slot: correct props and example
import { CopilotChat } from "@copilotkit/react-core/v2";
import type { CopilotChatInputProps } from "@copilotkit/react-core/v2";
function ChatInput({
isRunning, // v1: inProgress
onSubmitMessage, // v1: onSend
onStop,
value,
onChange,
}: CopilotChatInputProps) {
return (
<div className="custom-input">
<input
value={value}
onChange={(e) => onChange?.(e.target.value)}
disabled={isRunning}
placeholder="Type a message..."
/>
{isRunning ? (
<button onClick={onStop}>Stop</button>
) : (
<button onClick={() => onSubmitMessage?.(value || "")}>Send</button>
)}
</div>
);
}
export default function App() {
return (
<CopilotChat input={ChatInput} />
);
}
Why TS was complaining
- You passed a component expecting v1 props (
isVisible, inProgress, onSend).
- The v2
input slot requires the CopilotChatInputProps shape (isRunning, onSubmitMessage, value, onChange, onStop). Aligning these fixes the type error.
Optional: render-prop composition
If you need full control over layout while keeping slots:
<CopilotChat>
{({ input }) => (
<div className="my-layout">
{/* other UI */}
{input}
</div>
)}
</CopilotChat>
Was this helpful?
If this solution worked for you, please click on the appropriate option below to help us improve: