Skip to content

Props Reference

The Copilot accepts one required prop (mode) and a set of optional props that control the worker context, panel visibility, styling, and callbacks. Some props are build-specific - the Build column below indicates where each prop applies.

Required props

PropTypeDescriptionExample
modestringApplication mode. Controls UI layout and features. See Modes."embed"

Optional props

PropTypeDefaultBuildDescriptionExample
userIdstringauto-generatedAllUnique identifier for the current user (email, UUID, or internal user ID)."user-123"
typestring"worker"AllContext type. Determines which entity the copilot interacts with. Options: worker, agent."worker"
workerIdstring''AllID of a specific worker to use explicitly."worker-456"
agentIdstring''AllID of the AI agent to use (requires workerId)."agent-789"
versionnumber | nullnullAllVersion number of the worker or agent (internal use).1
showConversationsbooleanmode-dependentAllShow or hide the conversations panel in the sidebar. Default varies by mode.true
showActivitybooleanmode-dependentAllShow or hide the activity / trace panel for debugging. Default varies by mode.false
systemContextRecord<string, string>undefinedAllDynamic metadata passed to the postCopilotMessage API.{ firstName: 'John' }
containerIdstring-Browser ESM, UMDDOM element ID where the widget mounts. Not used by the React build."copilot-container"
shadowDombooleantrueBrowser ESMRender inside a shadow root to isolate styles. UMD is always shadow-DOM-enabled; React manages this internally.true

React example

import { Copilot } from '@/lib/copilot';
export function DashboardPage() {
return (
<Copilot
userId="user-123"
mode="embed"
systemContext={{ firstName: 'John' }}
/>
);
}

Browser ESM example

For the recommended non-React path, props are passed to CmtnCopilot.init() after dynamically importing the SDK. See the Browser ESM guide for the full setup.

<div id="copilot-container"></div>
<script type="module">
const { initializeCopilotSDK, CmtnCopilot } = await import('<YOUR_CDN_URL>');
initializeCopilotSDK('<YOUR_APP_KEY>', { environment: 'production' });
const instance = CmtnCopilot.init({
containerId: 'copilot-container',
mode: 'embed',
userId: 'user-123',
});
</script>

UMD example

The UMD build is a legacy fallback for environments without dynamic import(). Props are passed to sdk.Copilot.init(). See the UMD guide for the full setup.

<div id="copilot-container"></div>
<script>
const sdk = window.initializeCommotionSDK('<YOUR_APP_KEY>');
const copilot = sdk.Copilot.init({
containerId: 'copilot-container',
userId: 'user-123',
mode: 'embed',
});
</script>