GenerationCard

A prompt, a picture, and a reveal in pixels: coarse blocks sharpen step by step as speckle thins. Stop mid-way, Redo, and flip between earlier results. AI.

Open playground
Your picture appears here

About

GenerationCard is a React component in the AI category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { GenerationCard } from "@ashutoshswamy/smoui" and set defaultPrompt, placeholder, duration among its 6 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { GenerationCard } from "@ashutoshswamy/smoui";

<GenerationCard
  defaultPrompt="A lighthouse at dusk"
  source={(prompt) => "/api/image?q=" + encodeURIComponent(prompt)}
  onDone={(prompt, seed) => save(prompt, seed)}
/>

Props 6

defaultPrompt

Starting text in the prompt field.

string
placeholder

Hint when the field is empty.

string
duration

Seconds a generation takes.

numberdefault 3.6
source

Return a real image URL and the card plays the same reveal over it. Without it a seeded landscape stands in. Cross-origin images need CORS headers.

(prompt, seed) => string | Promise<string>
onGenerate

A generation started.

(prompt, seed) => void
onDone

A picture finished.

(prompt, seed) => void