ngx-prompt-kit

Image

Display an AI-generated image from base64 / Uint8Array bytes, or a regular URL via Angular's NgOptimizedImage.

Examples

From a URL

When you pass [src], the inner img uses NgOptimizedImage — Angular handles lazy-loading and priority hints.

Sample landscape

From base64 (e.g. an LLM image generation)

Pass [base64] and [mediaType]; falls back to a native img tag because NgOptimizedImage does not accept data: URLs.

Gradient placeholderTransparent placeholder

Loading placeholder

When neither src, base64, nor uint8Array is provided, an aria-labeled pulse box stands in.

Installation

Add the image component (and the cn() utility) to your project.

ng generate ngx-prompt-kit:image

Component API

PkImage

PropTypeDefaultDescription
altstringAlt text (required).
srcstringRegular image URL — uses NgOptimizedImage. Width and height required.
base64stringBase64 payload (renders as data: URL via plain img).
uint8ArrayUint8ArrayBinary payload (rendered as a blob: URL, revoked on destroy).
mediaTypestring 'image/png' MIME type for base64 / blob payloads.
widthnumberRequired when src is set.
heightnumberRequired when src is set.
classstringExtra classes for the img / placeholder.