Prompt Input

NEW

A production-ready AI chat composer with an auto-growing textarea, streaming stop control, attachment chips with drag-and-drop and paste, an accessible model picker, prompt history, and keyboard-first send behavior.

Say something to start. Your message streams back a reply.

Press Enter to send, Shift and Enter for a new line. Press Escape to stop a reply.

Installation

Add the component directly to your repository using shadcn CLI:

npx shadcn@latest add Surajmaurya1/easyui/prompt-input

API Reference

PropTypeDefaultDescription
onSend(payload: PromptSubmit) => void | Promise<void>undefinedCalled when the user sends. Throw or reject to put the message back in the box
streamingbooleanfalseWhile true the send button becomes a Stop button and Escape stops the reply
onStop() => voidundefinedCallback fired when the user stops a streaming response
modelsPromptModel[]DEFAULT_MODELSModels rendered in the accessible model picker listbox
modelstringundefinedControlled model id
defaultModelstringundefinedInitial model id when uncontrolled (defaults to the first model)
onModelChange(id: string) => voidundefinedCallback fired when the selected model changes
placeholderstring'Message the assistant…'Placeholder text for the textarea
maxLengthnumber8000Maximum character count before the message is flagged as over the limit
maxHeightnumber224Tallest the textarea grows in pixels before it starts scrolling
allowAttachmentsbooleantrueEnables the attach button, drag-and-drop, and paste file handling
maxFilesnumber5Maximum number of attachments allowed at once
maxFileSizeMBnumber10Maximum size per attachment in megabytes
acceptstringundefinedAccepted file types using the same format as an input accept attribute
disabledbooleanfalseDisables the composer and all of its controls
autoFocusbooleanfalseFocuses the textarea when the component mounts
enterToSendbooleandesktop onlyEnter sends and Shift+Enter adds a line. Defaults to true on fine pointers and false on touch devices. Cmd/Ctrl+Enter always sends
actionsReactNodeundefinedExtra buttons rendered next to the model picker
hintReactNode | falsekeyboard hintFooter line under the box. Pass false to hide it
safeAreabooleanfalsePads the bottom for the iPhone home indicator when pinned to the screen bottom
classNamestringundefinedCustom Tailwind class names for the outer wrapper