PromptInput
The composer for sending a prompt, with attachments, a toolbar and a way to stop.
Used in Recoverable chat, Workspace integrations, Agent Workbench and 1 more patterns.
- Use it for
- The composer for prompts, with attachments, toolbar, submit and cancel.
PromptInput preview
Installation
npm install @stackunseen/uiimport { PromptInput } from '@stackunseen/ui';@stackunseen/ui/styles.cssParts
One form with the text box in the middle. The slots around it hold your own controls; the text, attachments and whether sending is allowed stay with your app.
Command list
Opens above the text when someone types "/" or "@". Choosing an item calls you back with it.
Attachments
Your attachment chips above the text, for example a row of Attachment.
Text box
Grows with the text. Enter sends and Shift + Enter adds a line; typing with an input method never sends early.
Toolbar
Your own controls beside the send button, such as a model picker.
Send button
Sends the trimmed text. While a reply runs and you pass
onCancel, it becomes Stop response.Hint
A line under the box: your hint, or the reason sending is unavailable. Without either it is read to screen readers only.
Usage and props
Use standard for the main composer, compact in a small panel and inline for a short follow-up. Keep the draft in application state and explain why sending is unavailable. Your server takes the prompt, and confirms when a stop has worked.
valuestring- The controlled draft. Clear it when your application is ready to do so.
onValueChange(value: string) => void- Update value with the edited draft.
onSubmit(text: string) => void- Receives the trimmed draft. Send it through your application and track the result there.
busyboolean (optional)- Prevents another send while a response is in progress.
submitDisabledboolean (optional)- Disables sending while keeping the draft editable.
submitDisabledReasonstring (optional)- The explanation shown when submitDisabled is true.
attachmentsReactNode (optional)- Content above the draft, such as attachment previews. Handle uploads separately.
All props
Loading…
For your coding agent
Give the agent this page instead of a screenshot. The prompt wraps the page with the install and import lines and the rule that your server, not a click, completes an action.
- Contract
- value · onValueChange · onSubmit · busy · onCancel · attachments? · toolbar? · submitDisabled? · allowEmptySubmit? · limit? · variables? onInsertVariable? · assist?
- Keeps honest
- Your server takes the prompt, and confirms when a stop has worked.
- MCP
read_component "PromptInput"on the docs endpoint
Keyboard and customization
Keyboard
Enter sends a ready draft; Shift+Enter adds a line break. Enter does not send while composing with an IME. Tab reaches the toolbar and send or stop controls.
Customization
Change shared colors, spacing, corners and icons with the theme. Use the component's supported props to adapt its content and layout. Customization guide and Theme Studio