ngx-prompt-kit

Image

Display an AI-generated image from base64 / Uint8Array bytes, or a regular URL via Angular's NgOptimizedImage. An hlm-skeleton holds the space until there is something to show.

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

It is built on spartan/ui, so add these helm components too: skeleton.

ng g @spartan-ng/cli:ui skeleton

Component API

PkImage

PropTypeDefaultDescription
altstring — Alt text (required).
srcstring — Regular image URL — uses NgOptimizedImage. Width and height required.
base64string — Base64 payload (renders as data: URL via plain img).
uint8ArrayUint8Array — Binary payload (rendered as a blob: URL, revoked on destroy).
mediaTypestring 'image/png' MIME type for base64 / blob payloads.
widthnumber — Required when src is set.
heightnumber — Required when src is set.
classstring — Extra classes for the img / placeholder.