Composer attach Pro
One payment, every Pro piece. $11 tomorrow.
Install
npx shadcn@latest add @mu-pro/composer-attachPro. Installs with your licence key through the @mu-pro registry; the key comes with Pro. Lands in components/mu/composer-attach/ with the shared foundation.
Usage
import { ComposerAttach } from "@/components/mu/composer-attach/ComposerAttach";
<ComposerAttach upload={send} onSend={(text, files) => post(text, files.map((f) => f.result))} />Use with an agent Beta
npx shadcn@latest add @mu-pro/uisdk/composer-attachOptional. An AI agent in your app can read and set this piece by name, and you can ask before anything it can’t undo. The piece itself doesn’t change; installs with your Pro key, like the piece. Built on UI SDK 0.1.0-beta.23, which is in beta too, so this add-on follows its releases.
Source
How it works
Building with an agent? Hand it a ready prompt for this piece.
Input and reduced motion
- Pointer / touch: drag photos onto the composer; its edge swells up to meet them and each docks as a bead. Tap + to choose them instead (the only way on a phone). Tap a docked photo to take it off, or a failed one to retry.
- Keyboard: Tab reaches +, each docked photo, the words and send; Enter in the words sends. Send while photos go up says "Sends when the upload is done" and sends when they land.
- Busy and done: the root carries
aria-busywhile photos go up; the status line under the composer (role="status") says every state in words, never by colour alone. - Reduced motion: no swell and no rise: photos appear docked, the message leaves at once, the words land.
Props
| Prop | Default | What it does |
|---|---|---|
upload | — | (file, { onProgress, signal }) => unknown | sends one file as soon as it docks. Call onProgress(0–1), stop when signal aborts (the photo was taken off), and return a promise: it resolves (a tick) or rejects (a cross; tap the photo to retry) |
onSend | — | (text, files) => unknown | sends the message once every file is up; files carry each upload's result. Return a promise: if it rejects, the words and photos come back and it says "Didn't send · try again" |
value / defaultValue / onValueChange | "" | string | the words, if you hold them |
name | — | string | the text input's form name |
accept | "image/*" | an input's accept | what it takes; anything else is refused with words |
maxSize | none | bytes | the largest file it takes |
accent | false | boolean | hands the success light to the brand's --mu-signal |
disabled | false | boolean | takes nothing and sends nothing |
labels | see below | strings | placeholder, over, uploading, waiting, sent, failed, notSent |
className | — | — | added to the root |
Sound
None. It loads in silence.
None.
Licence
Included with Pro: use it in unlimited end products for you and your clients; no reselling as a kit. See the licence.
Drag a photo to the composer and its edge swells to meet it; it docks with a ring of progress, and sending pinches it off as a message.
For photo attachments in a composerMore in Upload & files