GodUI

Prompt Composer

An AI input box with auto-growing textarea, attachment chips, an inline model picker, and a send button that morphs into a stop control while streaming.

Press ⌘/Ctrl + Enter to send. Drop files onto the field to attach.

Installation

pnpm dlx shadcn@latest add "https://godui.design/r/prompt-composer.json"

The textarea auto-grows up to maxRows, then scrolls. Submit with the send button or ⌘/Ctrl + Enter. Drop or paste files to attach them as chips. While isStreaming is true, the send button cross-fades into a stop button.

Usage

tsx
 
import { PromptComposer } from "@/components/godui/prompt-composer";
tsx
 
<PromptComposer
  placeholder="Ask anything…"
  onSend={(text, attachments) => send(text, attachments)}
/>

Controlled value

tsx
 
const [value, setValue] = useState("");

<PromptComposer value={value} onValueChange={setValue} onSend={send} />;

Props

PropTypeDefaultDescription
valuestringControlled textarea value.
defaultValuestring""Uncontrolled initial value.
onValueChange(value: string) => voidFired on every keystroke.
onSend(value, attachments) => voidFired on submit with the text + attachments.
isStreamingbooleanfalseMorphs the send button into a stop button.
onStop() => voidFired when stop is pressed while streaming.
variant"comfortable" | "compact" | "minimal""comfortable"Visual density.
maxRowsnumber8Rows before the textarea scrolls.
attachmentsPromptAttachment[]Controlled attachment chips.
onAttachmentsChange(attachments: PromptAttachment[]) => voidFired when attachments change.
modelsstring[]Enables the inline model picker.
modelstringSelected model.
onModelChange(model: string) => voidFired when a model is chosen.

On this page

Built with GodUI

Beautifully crafted motion components for modern interfaces.

Star on GitHub