Prompt composer
v0.64.0, changelogBetaWhere 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.
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
- A one-line search: Search field.
- A long note on a record, with no sending: Textarea in a Field.
- Picking files with no message: File upload.
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,gets the trimmed text and the attached files; return false to keep the draft (say why beside it).files) - 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
streamingandonStop: Send becomes Stop in the same place and size, with focus kept, and Enter does not send. Abort the request inonStop. - Never a greyed Send without a reason: an empty box, an answer still streaming and a passed
maxLengthare said in words under the box and in Send's description.disabledtakesdisabledReason(offline, no access). allowFilesadds the attach button, paste and drop;accept,maxSizeandmaxFilesare checked as in file-upload and refused files are named with the reason. The files show as Attachment chips above the text.maxLengthshows 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.