injectChatLabels
Angular function that returns the CopilotKit chat labels, with provided overrides merged over the defaults
Overview
injectChatLabels returns the full set of CopilotChatLabels in scope: any labels you provided through provideCopilotChatLabels merged over COPILOT_CHAT_DEFAULT_LABELS. If no labels were provided, it returns the defaults unchanged.
It reads the COPILOT_CHAT_LABELS injection token (optionally), so it must run inside an Angular injection context (a constructor, a field initializer, or a factory). The prebuilt chat components call it internally; use it directly when you build your own chat UI and want the same configurable strings.
Signature
import { injectChatLabels } from "@copilotkit/angular";
function injectChatLabels(): CopilotChatLabels;Return Value
Returns a complete CopilotChatLabels object. Because the value is the merge of your overrides over the defaults, every field is always present (never undefined).
Usage
Call it from an injection context and read the labels you need.
import { Component } from "@angular/core";
import { injectChatLabels } from "@copilotkit/angular";
@Component({
selector: "app-my-chat",
standalone: true,
template: `<input [placeholder]="labels.chatInputPlaceholder" />`,
})
export class MyChatComponent {
protected readonly labels = injectChatLabels();
}