Image Studio
A prompt-to-image workspace for apps built on image models. Results come into focus as the model works, and any image can be refined from the composer.
- Categoria
- IA
- Componentes usados
- 18
- Arquivos
- 12
- Exemplos de uso
- 3
- Acesso
- HextaUI Pro (55 blocos)
- Código atualizado
- Contado em
- Estudo de uso de componentes
Parte do HextaUI Pro, todos os 55 blocos, $49 pagamento único, Comparar planos
Image models take seconds per image, fail one image at a time and return results people want to keep working on. Image Studio covers that loop the way a chat does: history reads down to a composer pinned at the bottom, and each prompt lands as a new batch right above it.
While the model works, every placeholder sits at the exact final shape and comes into focus. A blue dither field (or ASCII glyphs with developEffect) flows across each tile while the image draws itself in its own colours from top to bottom behind a wavy edge, driven by the progress you report. The pointer swirls and lights the dots it passes over, a click or tap sends a ripple, and when the final image lands a bulge rolls up from the bottom, then the dither eases through pixel blocks into the real image. One line above the batch names the phase, like Composing or Adding detail, with the percentage and elapsed time, the same pattern as the Thinking block.
Providers stream differently, and the field only draws what you yield. If your API sends partial images (OpenAI partial_images, ComfyUI or fal previews), yield each one as preview on a progress event. If it reports steps, yield step and steps. If it only says pending, yield an estimated progress and the field stays a quiet blue wait until done. The default scan reveal is stylised: models don't paint from top to bottom, so it maps progress onto rows as a look, not a readout. Set developReveal="refine" to show only what the model returned: partial images dissolve in across the whole frame and sharpen from coarse blocks as progress rises, the way diffusion refines all of an image at once. Both modes read the same events.
The common path stays one gesture each: type and press Enter, hover a result and press Refine, describe the change. Aspect ratio and style sit in the composer, and count, model, seed and a negative prompt wait in one Options popover. Vary, upscale, region edits, reuse, download and delete live in the image menu and the viewer.
Rows keep every batch next to its prompt, never shift while loading, and move in reading order. Failed images show the reason and a Retry that reuses their seed and the batch’s own runner.
Obtenha o HextaUI Pro
Um único pagamento libera todos os blocos, incluindo os futuros. Ver preços.
Adicione o registro Pro ao components.json
components.json Adicione seu token
Crie um token na sua página de conta e coloque-o em
.env.localcomoHEXTAUI_PRO_TOKEN.Adicione o bloco
pnpm dlx shadcn@latest add @hextaui-pro/image-studio
Polling an image API
Write onGenerate as an async generator. Start a job, poll it with sleep(ms, signal) and yield queued, progress, done or error per image. Cancel aborts the signal and calls onCancel, and onComplete hands you each finished batch to save.
Editing a region
onEdit runs both edits. Refine sends request.source and the new prompt with no mask. Edit a region adds a black-and-white PNG mask at the image’s full size, ready for an inpainting endpoint. Use MaskEditor on its own to add region edits to any image you already show.
As a chat tool result
useImageRuns, ImageGeneration and ImageComposer work without the full studio. Render them in a tool result and stream events from Server-Sent Events through createImageEventQueue.
Anatomia
As partes que você compõe, de fora para dentro.
| Parte | Descrição |
|---|---|
ImageStudio | The workspace: a header slot with search and favorites, the day-grouped feed, the bottom composer, the viewer and the region editor. Owns runs, refinement, optimistic favorites and undoable deletes. |
ImageComposer | Prompt input with a reference image, aspect ratio, style, the Options popover (count, model, seed, avoid) and a credits hint. Shows a Refining chip when it is editing an image. |
ImageGeneration | One batch: prompt, a live phase line with the orb while it runs, then settings, palette and duration, above a grid at the batch’s aspect ratio. |
ImageTile | One image. Comes into focus as progress rises, reveals the result, shows errors with Retry, and offers Refine, Vary and more on hover or focus. |
DevelopField | The developing surface: a canvas of dithered dots, or monospace glyphs, in the theme's info blue that renders streamed previews in their own colours, settling from the top or, with refine, sharpening across the frame. Canvas only, paused off-screen, still under reduced motion. |
ImageLightbox | Full-size viewer with zoom, pan, arrow keys between results, every setting, and Refine as the primary action. |
MaskEditor | Paint or erase a mask with a mouse, finger or the keyboard, then describe what goes there. |
useImageRuns | The run engine. Starts, retries and cancels runs, applies events, times each batch and reports finished batches. |
ImageStudio
Também aceita todas as props de div, exceto children.
| Prop | Tipo | Padrão |
|---|---|---|
generationsSaved history, newest first or in any order. Local runs are merged in by id. | Generation[] | – |
modelsModels to pick from. credits drives the hint, maxCount caps the count, and supportsNegative and supportsReference hide those controls. | ImageModel[] | – |
presetsStyle presets. The picker hides when empty. | ImagePreset[] | [] |
onGenerate(request, { signal }) => AsyncIterable<ImageEvent>. Yield queued (with an optional position in line), progress (progress or step and steps, plus an optional preview), done and error events per image index. Retry uses the runner that made the batch. | ImageRunner | – |
onVaryRuns a variation. request.source holds the image and request.strength is subtle or strong. Hidden when missing. | ImageRunner | – |
onUpscaleRuns an upscale of request.source. Hidden when missing. | ImageRunner | – |
onEditRuns edits of request.source with the new prompt: Refine sends no mask, Edit a region adds request.mask as a PNG Blob, white where the person painted. Both are hidden when missing. | ImageRunner | – |
onCancelCalled after Cancel aborts a run, so you can stop the job on the server. | (request: ImageRequest) => void | Promise<void> | – |
onCompleteCalled when a run settles, including cancelled and partly failed ones, with duration in milliseconds. Save it to your history here. | (generation: Generation) => void | – |
onFavoriteApplied at once. A rejection rolls it back and shows the error. | (image, favorite, generation) => void | Promise<void> | – |
onDeleteCalled once the Undo window closes. A rejection brings the image back with an error. | (image, generation) => void | Promise<void> | – |
onLoadMoreLoads older history when the top of the feed comes into view. The scroll position holds while it prepends. | () => void | Promise<void> | – |
hasMoreWhether older history exists. | boolean | false |
loadingShows skeleton batches while the first page of history loads. | boolean | false |
uploadUploads a reference image with progress. Without it, the file is passed in request.reference.file. | PromptUpload | – |
defaultSettingsStarting aspect ratio, count, model, style and seed. | Partial<ImageSettings> | – |
suggestionsPrompt ideas shown when the history is empty. Picking one fills the composer and its aspect ratio. | { label, prompt, aspectRatio? }[] | [] |
headerYour brand, credits or account, shown at the start of the top bar. Search and favorites sit at its end once there is history. | ReactNode | – |
headerClassNameClasses for the top bar, such as extra end padding for your own floating controls. | string | – |
developEffectHow a generating image draws itself: coloured ASCII glyphs or an ordered dither of coloured dots. Both take the same hover, ripple, bulge and pixel reveal. | "ascii" | "dither" | "dither" |
developRevealscan is a stylised top-to-bottom draw driven by progress. refine shows partial images across the whole tile and sharpens them with progress, matching how models stream. | "refine" | "scan" | "scan" |
autoFocusFocuses the composer on mount, without scrolling the page. Leave it off when the studio is embedded below other content, so the page keeps its scroll position and keyboard focus. | boolean | false |
undoTimeoutHow long Undo stays available after a delete, in milliseconds. 0 deletes at once. | number | 5000 |
nowFixes the date used for Today and Yesterday, for tests and server rendering. | Date | – |
useImageRuns
Returns { live, start, retry, cancel, remove }.
| Prop | Tipo | Padrão |
|---|---|---|
onCompleteCalled when a run settles. | (generation: Generation) => void | – |
onCancelCalled after a run is cancelled. | (request: ImageRequest) => void | Promise<void> | – |
announceReceives short status messages for a live region. | (message: string) => void | – |
createImageEventQueue
Turns callback or event-stream APIs into the async iterator a runner returns.
| Prop | Tipo | Padrão |
|---|---|---|
pushQueues an event. | (event: ImageEvent) => void | – |
endEnds the stream. Images still unfinished are marked as failed. | () => void | – |
failEnds the stream with an error shown on every unfinished image. | (error: unknown) => void | – |
| Tecla | Ação |
|---|---|
| Enter | Generates from the prompt, or refines the picked image. Shift+Enter adds a line, and ↑ in an empty prompt brings back the last one. |
| Esc | In the composer, stops refining and goes back to a fresh prompt. In search, clears and closes it. |
| ←→↑↓ | Moves between images in the feed. The grid is one tab stop, and arrows follow the layout across batches. |
| HomeEnd | Jumps to the oldest or newest image in the feed. |
| Enter | Opens the focused image in the viewer, where ← and → move between results and Esc closes. |
| R | Refines the focused image: the composer picks it up and asks what to change. |
| F | Favorites the focused image. |
| V | Starts a subtle variation. Shift+V, or Shift-clicking Vary, starts a strong one. |
| U | Upscales the focused image. |
| E | Opens Edit a region. In the editor, arrows move the brush, Space starts or stops painting, [ and ] change its size, and ⌘Z undoes a stroke. |
| Delete | Deletes the focused image, with Undo in the toast. |
- Every image is labelled from its prompt and position, such as “Image 2 of 4: A lone lighthouse…”, and placeholders add their state, such as Queued, In line, 2nd, Step 12 of 30 or Timed out.
- Starts, finished batches, failures, refinements, favorites and deletes are announced through a polite live region with one short message per change, not one per step. Running batches are aria-busy.
- Status never relies on color. The phase line is text with a percentage, tiles show step counts, errors carry an icon and text, favorites use a filled icon and aria-pressed, and the Options dot is repeated in the button’s label.
- With a fine pointer, image actions appear on hover or focus. On touch screens tiles stay clean and a tap opens the viewer, whose actions are 44px tall. Focus moves to a neighbour after a delete and returns to the image after Undo or closing the viewer.
- The dither or ASCII field draws every tile from one shared loop at up to 30fps, pauses off-screen and holds a still frame under reduced motion that still tracks progress. The reveal becomes a short fade, and forced-colors mode drops the field while keeping borders and focus rings.
Construído com
Os componentes gratuitos do HextaUI de que Image Studio é feito. Cada um é instalado separadamente.
Código
12 arquivos, adicionados a components/blocks/image-studio.