CopilotSidebar

Responsive docked or overlay Copilot chat sidebar for Angular.


CopilotSidebar renders a left- or right-positioned assistant in docked or overlay mode. It is a standalone, OnPush component with the selector copilot-sidebar.

import { Component, signal } from "@angular/core";
import { CopilotSidebar } from "@copilotkit/angular";

@Component({
  imports: [CopilotSidebar],
  template: `
    <copilot-sidebar
      [(open)]="open"
      mode="docked"
      position="right"
      [width]="480"
      title="Workspace assistant"
    />
  `,
})
export class WorkspaceAssistant {
  readonly open = signal(false);
}

Inputs and model

NameTypeDefaultBehavior
openModelSignal<boolean>trueTwo-way bindable open state
mode"docked" | "overlay""docked"Desktop presentation mode
position"left" | "right""right"Logical side of the viewport
widthnumber | string480Pixel number or CSS dimension
titlestring"Copilot"Landmark/dialog name and header text
clickOutsideToClosebooleanfalseOpts into overlay backdrop closing
chatComponentType<unknown>CopilotChatReplacement chat body component
headerComponentType<unknown> | undefinedundefinedReplacement header component

Overlay mode uses modal dialog semantics, focus trapping, Escape closing, and launcher-focus restoration. Docked mode uses a complementary landmark and adjusts the document's logical body margin. Compact viewports always use the modal presentation.

Only one docked sidebar may own document layout at a time. A second open docked sidebar is rejected and logs a clear warning; independent overlay sidebars are allowed. On close or destroy, the owner restores the exact prior body margin and removes its media-query listener. DOM and media-query work is browser-only and begins after render, so SSR remains inert. Keep open, mode, and position stable through hydration.