showcase/shell-docs/src/content/reference/components/CopilotSidebar.mdx
CopilotSidebar renders a fixed sidebar panel for chat interaction. It wraps CopilotChat and provides sidebar-specific layout and open/close behavior. The sidebar includes a header with a title and close button, and can be toggled via a floating button.
See CopilotPopup for a popup variant of this component.
import { CopilotSidebar } from "@copilotkit/react-core/v2";
import "@copilotkit/react-core/v2/styles.css";
CopilotSidebar accepts all props from CopilotChatProps except chatView, which is set internally to CopilotSidebarView. This includes:
<PropertyReference name="inputProps" type="Partial<Omit<CopilotChatInputProps, 'children'>>"
Additional props forwarded to the inner CopilotChatInput component.
</PropertyReference>
<PropertyReference name="welcomeScreen" type="SlotValue<React.FC<WelcomeScreenProps>> | boolean"
Controls the welcome screen shown when no messages exist. </PropertyReference>
All CopilotChatView slot props (messageView, input, scrollView, inputContainer, feather, disclaimer, suggestionView) are also accepted and forwarded through.
All slot props follow the same override pattern used across CopilotKit v2 components. Each slot accepts one of three value types:
| Value | Behavior |
|---|---|
| Component | Replaces the default component entirely. Receives the same props the default would. |
className string | Merged into the default component's class list via twMerge. |
| Partial props object | Spread into the default component as additional or overriding props. |
function App() {
return (
<CopilotSidebar
agentId="my-agent"
labels={{ modalHeaderTitle: "Assistant" }}
/>
);
}
function App() {
return <CopilotSidebar agentId="my-agent" defaultOpen={true} width={500} />;
}
function App() {
return (
<CopilotSidebar agentId="my-agent" header="bg-indigo-700 text-white" />
);
}
CopilotChatToggleButton internally.defaultOpen prop sets the initial state; after that, state changes come from user interaction (toggle button, close button in the header).CopilotSidebarView internally, which provides a sidebar-specific welcome screen layout with suggestions at the top, the welcome message in the middle, and the input fixed at the bottom.CopilotChat logic.CopilotChat -- the base chat component used internallyCopilotPopup -- popup variantCopilotChatView -- the layout component used internally