Drop pill Pro
Get Pro at $10
One payment, every Pro piece. $11 tomorrow.
Install
npx shadcn@latest add @mu-pro/drop-pillPro. Installs with your licence key through the @mu-pro registry; the key comes with Pro. Lands in components/mu/drop-pill/ with the shared foundation.
Usage
import { DropPill } from "@/components/mu/drop-pill/DropPill";
<DropPill accept=".pdf,image/*" maxSize={50e6} upload={send} onDone={(file, res) => setFile(res)} />
<DropPill multiple upload={send} onEach={(file, res) => add(res)} onAll={(files) => save(files)} />
<DropPill size="md" accept=".svg,image/png" maxSize={5e6} upload={send} labels={{ idle: "Upload" }} />Source
How it works
Building with an agent? Hand it a ready prompt for this piece.
Input and reduced motion
- Pointer / touch: drag files from the desktop onto the pill; the pill reaches up for them and says "Release to upload". Tap or click it to choose files instead (the only way on a phone).
- Keyboard: the pill is one button: Enter or Space opens the file chooser; after a failed upload it retries. A failed bead (
multiple) is its own button that retries, or removes a refused file. - Busy and done: the root carries
aria-busywhile files go up; what lands and what fails is announced (role="status") in words, never by colour alone. - Reduced motion: no reach, no travel: the swell follows the progress without gliding, beads appear in place and leave at once, the droplet doesn't leap, and the words land.
Props
| Prop | Default | What it does |
|---|---|---|
upload | — | (file, { onProgress, signal }) => unknown | sends one file. Call onProgress(0–1) as it goes, stop when signal aborts, and return a promise: it resolves (the file is in) or rejects (it says "Didn't upload" and a tap retries). With none, a file is in at once |
accept | any | an input's accept | the types it takes (.pdf,image/*); another is refused with words, never sent |
maxSize | none | bytes | the largest file it takes; a bigger one says "Too big · up to 50 MB", never sent |
multiple | false | boolean | take several: each buds off as its own bead with a ring of progress, at most four at once while the rest wait their turn, and slides back in when it lands |
size | "lg" | lg 60px, md 44px | the hero, or a pill for a form row (one line of words) |
align | "center" | center, end | where a single file's pill tightens to when it's in: its middle (a hero), or its end (a pill at the end of a row) |
accent | false | boolean | hands the success light to the brand's --mu-signal |
disabled | false | boolean | takes nothing |
labels | see below | strings | idle, hint, over ({n} files), done, count ({n} of {of}), all ({n}), failed, tooBig ({max}), wrongType |
onDone | — | (file, result) => void | the one file is in (single mode) |
onEach | — | (file, result) => void | each file as it lands, in either mode |
onAll | — | (files) => void | a drop has settled (every file in or failed); gets the ones that are in, each a DropPillFile with its file and result |
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.
Drop a file on the pill: it reaches up for it, swallows it, and a swell carries it along as it uploads; drop several and each buds off as its own bead.
For file upload and drag-and-dropMore in Upload & files