← AI Chat API

Component · v2.7.1

NgbAiChatComponent

A conversation transcript with a composer, retry actions and response feedback.

Import

import { NgbAiChatComponent } from '@angular-bootstrap/ngbootstrap';

Selector:ngb-ai-chat

Usage notes

  • This is a presentation component. Your application owns provider requests, credentials, cancellation, persistence and error handling. Rendered response text is not executable HTML.

Declaration

Inputs

label

Visible heading or label for the component.

readonly label: i0.InputSignal<string>

userLabel

Label used for user messages.

readonly userLabel: i0.InputSignal<string>

assistantLabel

Label used for assistant messages.

readonly assistantLabel: i0.InputSignal<string>

emptyText

Text displayed when there are no results.

readonly emptyText: i0.InputSignal<string>

messages

Application-owned messages rendered in array order. Update these to display streamed text.

readonly messages: i0.InputSignal<readonly NgbAiMessage[]>

suggestions

Suggested prompts shown as buttons in the composer.

readonly suggestions: i0.InputSignal<readonly string[]>

busy

Marks a request in progress and prevents another submission. The application controls this state.

readonly busy: i0.InputSignal<boolean>

disabled

Disables user actions. This does not cancel an existing backend request.

readonly disabled: i0.InputSignal<boolean>

error

Application-provided error message displayed to the user.

readonly error: i0.InputSignal<string>

Outputs

promptSubmit

Emits the submitted prompt. The application calls its backend and supplies the result.

readonly promptSubmit: i0.OutputEmitterRef<string>

stop

Requests cancellation. The application must abort its backend request and clear busy.

readonly stop: i0.OutputEmitterRef<void>

retry

Emits the ID of the message whose Retry button was activated.

readonly retry: i0.OutputEmitterRef<string>

feedback

Emits a message ID and rating. Activating the same rating again clears it.

readonly feedback: i0.OutputEmitterRef<NgbAiFeedback>

Properties

ratings

readonly ratings: i0.WritableSignal<Record<string, "helpful" | "unhelpful" | null>>

Methods

rate

rate(id: string, value: "helpful" | "unhelpful"): void

Referenced types

Source: src/ai/src/ai-chat.component.ts in the installed @angular-bootstrap/ngbootstrap package. Angular compiler metadata and private members are omitted.

This project is not affiliated with ng-bootstrap or ngx-bootstrap. Those projects focus mainly on Bootstrap components for Angular. ngbootstrap focuses on Angular UI for data-heavy apps, especially Data Grid, Angular-native Form Builder, drag and drop workflows, documentation examples, and performance-focused Angular patterns.