Prodular UI

Prompt input

AI

The composer for AI chat: an autosizing textarea with attachments, tools and a send button that turns into a stop button while the model answers.

npx prodular-ui add prompt-input

Assistant thread

Everything together: question, reasoning, tool calls, a streamed answer with citations, actions, follow-ups and the composer. Press Replay to stream it again, or stop it halfway.

Ledgerline CopilotSeptember cloud spend
Why did our cloud spend jump in September?
Ledgerline CopilotClaude Opus 5.5

Copilot can make mistakes. Check figures before you share them.

With attachments and tools

Attachments sit above the text. Tools go left, dictation and send go right.

vendor-invoices-q3.csvCSV, 214 KB
Northbeam MSA 2026.pdfPDF, 1.2 MB

Status

Pass status on every render. The send button follows it.

Idle
Submitting
Streaming, the send button stops the answer
Error, the draft is kept so people can resend

The request timed out. Your message was not sent.

Anatomy

<PromptInput status={status} onSubmit={send} onStop={abort}>  <PromptInputAttachments>{attachments}</PromptInputAttachments>  <PromptInputTextarea placeholder="Ask anything" />  <PromptInputToolbar>    <PromptInputTools>      <PromptInputButton tooltip="Attach files"><PaperclipIcon /></PromptInputButton>      <PromptInputToggle><GlobeIcon data-icon="inline-start" />Search</PromptInputToggle>    </PromptInputTools>    <PromptInputActions>      <PromptInputButton tooltip="Dictate"><MicIcon /></PromptInputButton>      <PromptInputSubmit />    </PromptInputActions>  </PromptInputToolbar></PromptInput>

Guidance

Use it when

  • One composer per conversation, pinned to the bottom of the thread and centered to the same width as the messages.
  • Put attachments in PromptInputAttachments so they read as part of the message being written.
  • Use PromptInputToggle for switches that change how the next answer is produced, such as web search or deep research.

Avoid

  • Disabling the textarea while the model answers. People should be able to write the next message while they read.
  • More than four controls on the left. Move rarely used tools into a menu.
  • A separate stop button. PromptInputSubmit becomes the stop button while streaming.

Rules for AI agents

Published in llms-full.txt, the registry and the MCP server, so coding agents follow them when they build with this component.

  • Always pass status to PromptInput: "submitting" from send until the first token, "streaming" while tokens arrive, "error" when the request fails, "idle" otherwise. Never leave it at idle during a request.
  • Always pass onStop together with status="streaming" and abort the request in it.
  • Use onSubmit(text) to send. It receives trimmed text, is never called for empty input and clears the field. Do not attach your own Enter key handler: Enter sends, Shift+Enter adds a line and IME composition is ignored.
  • Every PromptInputButton that only holds an icon needs tooltip, which also becomes its aria-label.
  • On error keep the draft (pass clearOnSubmit={false} or restore value) and show the reason in text next to the composer.
  • Render the composer inside the page surface, not inside another card.

API

PromptInput

PropTypeDefaultDescription
status"idle" | "submitting" | "streaming" | "error""idle"Request state. Streaming turns the send button into a stop button.
onSubmit(text: string, event) => voidCalled with the trimmed text on Enter or send.
onStop() => voidCalled when the stop button is pressed while streaming.
value / defaultValue / onValueChangestringControlled or uncontrolled text.
allowEmptySubmitbooleanfalseAllow sending without text, for example with attachments only.
clearOnSubmitbooleantrueClear the text after sending.

PromptInputTextarea

PropTypeDefaultDescription
maxRowsnumber8Grows from one line up to this many, then scrolls.

PromptInputButton

PropTypeDefaultDescription
tooltipstringHover label and accessible name for icon buttons.

PromptInputToggle

PropTypeDefaultDescription
pressed / onPressedChangebooleanOn and off state for tools such as web search.

Installation

The Prodular UI CLI adds the source to components/ui with everything it depends on. In a project that already uses shadcn/ui, the shadcn CLI installs it from the Prodular registry too. See Installation for the first setup.

npx prodular-ui add prompt-input# or, with the registry in components.jsonnpx shadcn@latest add @prodular/prompt-input