Image Generation

A placeholder for AI images that reserves the final aspect ratio up front, moves through queued, generating and refining stages with a dither pattern and a clearing blur, then shows your image, video or canvas, with retry on failure.

Preview

Image Generation preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/image-generation
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

children?
ReactNode

The completed media. Pass an img, Next Image, canvas, video, or custom preview.

—
status?
"error" | "complete" | "queued" | "generating" | "refining"
generating
label?
string

Accessible description. Defaults to a description derived from prompt.

—
prompt?
string
—
resolution?
string
1024 × 1024
aspectRatio?
AspectRatio

CSS aspect ratio reserved before generated media is available.

1 / 1
size?
"compact" | "fluid"
compact
interactive?
boolean

Lets the active dither cluster follow fine-pointer movement.

true
statusText?
string
—
showStatus?
boolean
true
onRetry?
(() => void)
—
className?
string
—
mediaClassName?
string
—
statusClassName?
string
—

Composition

Put the image in the assistant row that holds the prompt and knows when generation completes.

Message
└── MessageContent
    └── ImageGeneration
        └── GeneratedMedia

Note: Message ties the image to the assistant turn that made it. Streaming Response carries the prose that comes with the image. Prompt Input takes the instruction that kicks off generation.

How it works

Reserve the space for generated media before any pixels exist. One frame stays put while each stage brings the picture closer to finished, and at the end it is just a normal image people can look at closely.

Updated