Image Generation

An image-generation state with dither progress and a completed result. Pass the finished media as children (img, Next Image, video, or a custom preview).

Generating

Demo runs generating → refining → complete once. Pass media as children; it reveals when status reaches complete.

Loading…

Installation

CLI
npx @sonojs/ui@latest add image-generation
Also needsnpm i lucide-react motion

Usage

image-generation.tsx
import {
  ImageGeneration,
  imageGenerationDemoSrc,
} from "@/components/ui/image-generation"

export function Example() {
  return (
    <ImageGeneration
      status="complete"
      prompt="Portrait study, ink stipple"
      resolution="1024 × 1024"
      aspectRatio="1 / 1"
    >
      <img
        src={imageGenerationDemoSrc}
        alt="Generated portrait"
      />
    </ImageGeneration>
  )
}

Props

PropTypeDefaultDescription
childrenReactNode—Completed media (img / Next Image / canvas / video / custom).
statusImageGenerationStatus"generating"`queued` | `generating` | `refining` | `complete` | `error`.
promptstring—Shown under the status line in quotes.
resolutionstring"1024 × 1024"Badge in the media corner. Pass empty to hide.
aspectRatioCSSProperties["aspectRatio"]"1 / 1"Reserved frame size before media loads.
size"compact" · "fluid""compact"`compact` caps width at `max-w-52`.
interactivebooleantrueDither cluster follows fine-pointer movement when hover-capable.
showStatusbooleantrueToggle the status row under the frame.
onRetry() => void—Shows Try again when `status` is `error`.
classNamestring—Merge classes on the root.