← AI Prompt workspace API

Component · v2.7.0

NgbAiPromptComponent

A draft workspace for reviewing, applying, regenerating and dismissing responses.

Import

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

Selector:ngb-ai-prompt

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>

promptLabel

Visible label for the draft composer.

readonly promptLabel: i0.InputSignal<string>

emptyText

Text displayed when there are no results.

readonly emptyText: i0.InputSignal<string>

responses

Application-owned drafts displayed for review.

readonly responses: i0.InputSignal<readonly NgbAiResponse[]>

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>

responseApply

Emits the chosen response. The application decides how to apply it.

readonly responseApply: i0.OutputEmitterRef<NgbAiResponse>

regenerate

Emits the response to regenerate; the application requests a replacement.

readonly regenerate: i0.OutputEmitterRef<NgbAiResponse>

responseDismiss

Emits the response ID to dismiss. Remove it from the responses input in the application.

readonly responseDismiss: i0.OutputEmitterRef<string>

Referenced types

Source: src/ai/src/ai-prompt.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.