PromptInput

Markdown

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.
Not for
Plain form fields. Try Textarea or Chat.

PromptInput preview

Shift + Enter for a new line

Installation

npm install @stackunseen/ui
import { PromptInput } from '@stackunseen/ui';
Styles: @stackunseen/ui/styles.css

Parts

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.

  1. Command list

    Opens above the text when someone types "/" or "@". Choosing an item calls you back with it.

    Propscommands onCommand mentions onMention onMentionQueryChange

  2. Attachments

    Your attachment chips above the text, for example a row of Attachment.

    Built fromAttachment

    Propsattachments

  3. Text box

    Grows with the text. Enter sends and Shift + Enter adds a line; typing with an input method never sends early.

    Propsvalue onValueChange placeholder disabled disabledReason textareaRef selection onSelectionChange

  4. Toolbar

    Your own controls beside the send button, such as a model picker.

    Propstoolbar

  5. Send button

    Sends the trimmed text. While a reply runs and you pass onCancel, it becomes Stop response.

    Built fromIconButton, Button

    PropsonSubmit busy onCancel submitDisabled submitDisabledReason allowEmptySubmit

  6. Hint

    A line under the box: your hint, or the reason sending is unavailable. Without either it is read to screen readers only.

    Propshint

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.
How state and callbacks work
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
Open the Markdown file

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