ngx-prompt-kit

Response Stream

Reveals text chunk-by-chunk to mimic an LLM's streaming response. Two modes: typewriter (cumulative) or fade (per-word).

Examples

Typewriter mode

One chunk per animation frame. Speed is on a 1–100 scale.

A response stream lets you reveal generated text incrementally. The component takes a string, a mode, and a speed; it handles the rendering frames for you.

Fade mode

Each word fades in independently. Feels softer for long-form output.

A response stream lets you reveal generated text incrementally. The component takes a string, a mode, and a speed; it handles the rendering frames for you.

Live streaming (continues, doesn't restart)

Simulates an LLM streaming response: chunks arrive every ~150ms and append to the bound signal. The typewriter continues from where it left off rather than restarting on every update.

Big chunks, slow cadence

A larger paragraph-sized chunk arrives every 1000ms — closer to a real LLM that streams complete sentences. Same continuation behaviour: typewriter advances through the new content without restarting.

Installation

Add the response-stream component (and the cn() utility) to your project.

ng generate ngx-prompt-kit:response-stream

Component API

PkResponseStream

PropTypeDefaultDescription
textStreamstring '' The full text to reveal incrementally.
mode"typewriter" | "fade" "typewriter" Reveal style.
speednumber 20 1–100. Higher = faster.
fadeDurationnumberOverride per-segment fade duration in ms.
segmentDelaynumberOverride per-segment delay in ms.
characterChunkSizenumberOverride characters revealed per frame.
completedoutput<void>Fires when the stream finishes.
classstringExtra classes for the wrapper.