Skip to content
Design System
GitHub

Prompt composer

v0.64.0, changelogBeta

Where someone writes to a model: a form with a growing text box, Enter to send (never during IME composition), attachments, Send that becomes Stop, and disabled reasons and limits in words.

Enter sends, Shift+Enter starts a new line
Write a message or attach a file to send

Default

Install
npx shadcn add @syncrobotic/prompt-composer

Also installs: lucide-react@^1, @syncrobotic/cn, @syncrobotic/attachment, @syncrobotic/button, @syncrobotic/file-upload, @syncrobotic/format-number

Overview

When to use

  • The foot of an assistant panel or a side copilot.
  • A prompt to a vision model about a camera frame, with the frame attached.
  • Any free-text request to an agent that may take files.

Use something else

More examples

States and real uses. Each example is also a Storybook story and a visual regression test.

With files

Streaming

Over limit

Disabled

Try

Traditional Chinese (zh-TW)

Usage rules

  • It is a real <form>: onSubmit(text, files) gets the trimmed text and the attached files; return false to keep the draft (say why beside it).
  • Enter sends and Shift+Enter starts a new line. Enter that ends an input method's composition (Zhuyin, Cangjie, Pinyin, kana) only commits the characters: never send on it in your own handlers either (isComposingEnter).
  • While the answer streams pass streaming and onStop: Send becomes Stop in the same place and size, with focus kept, and Enter does not send. Abort the request in onStop.
  • Never a greyed Send without a reason: an empty box, an answer still streaming and a passed maxLength are said in words under the box and in Send's description. disabled takes disabledReason (offline, no access).
  • allowFiles adds the attach button, paste and drop; accept, maxSize and maxFiles are checked as in file-upload and refused files are named with the reason. The files show as Attachment chips above the text.
  • maxLength shows the count ("120 / 4,000"); past it the box and the count take the danger edge and words, and Send waits. Nothing is cut off.
  • Put a model select or a context chip in toolbar, beside the attach button. The composer has no fixed positioning: pin it with the page's layout (see the overview).

Changelog

  • 0.64.02026-12-01Formatted with Prettier (class order sorted); the code is unchanged.
  • 0.53.02026-11-27Its doc opens with its description, word for word; the code is unchanged.
  • 0.51.02026-11-27Comments trimmed to what they need to say; the code is unchanged.

How to upgrade