Image Prompt InputPRO
A multimodal prompt box: images land in it as chips, then you ask about them.
Code
2 files · 340 lines of TypeScriptPRO
Image Prompt Input is part of Pro
Get its source, the one-paste agent prompt and all 113 components, for a one-time $99.
Motion notes
- An attached image lands with a small spin and settle while its thumbnail zooms down into the chip, like a photo dropped on the table.
- The tray opens on a layout spring to make room for the first chip, and after the last one leaves it waits a beat, so the chip shrinks away before the box closes.
- A progress ring draws over the dimmed thumbnail while it uploads. The send button breathes three dots until it's done, then morphs to send, and to stop with a spinning ring while generating.
- Enter sends, Shift+Enter adds a line, and upload and generating status is announced politely. With reduced motion chips simply fade.
Usage
Example
<ImagePromptInput
attachments={images}
onAttach={openPicker}
onRemove={(id) => setImages((all) => all.filter((i) => i.id !== id))}
isGenerating={status === "streaming"}
onSubmit={(text, images) => send({ text, images })}
onStop={stop}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| attachments | ImageAttachment[] | [] | { id, src, name, size?, progress?, status: "uploading" | "done" | "error" }. You own upload state. |
| onRemove | (id: string) => void | — | Shows a remove button on each chip. |
| onAttach | () => void | — | Shows the attach button. Open your file picker here. |
| value | string | — | Controlled text. Leave it out for uncontrolled use. |
| onValueChange | (value: string) => void | — | Called on every change. |
| onSubmit | (value: string, attachments: ImageAttachment[]) => void | — | Called with the trimmed text and the uploaded images. |
| onStop | () => void | — | Called when stop is pressed while generating. |
| isGenerating | boolean | false | Shows the stop state. |
| placeholder | string | "Ask about an image…" | Placeholder text. |
| className | string | — | Classes for the form; the default is max-w-md. |