File upload
Shown as Satchel, a made-up product
A file upload in an accountant's client portal: limits stated and enforced, per-file spring progress, a real stopped state with Retry, and a document checklist that fills as files land.
Installation
pnpm dlx shadcn@latest add "https://propui.dev/r/satchel-upload.json?token=…"Adds the piece to components/propui/03-satchel-upload/ and installs motion. Needs a free account: sign in and the command includes your token. Fonts load from Prop UI; download the zip to self-host them.
When to use
Reach for it when
- Collecting a known set of documents from a client, with a checklist that fills as files land.
- An upload with stated limits (types, size, count) that are enforced and explained per file.
- Uploads that can fail part way and need a real stopped state with Retry.
Something else fits when
- A single avatar or image picker: a plain file input with a preview is lighter.
- Very large files or folders that need resumable, chunked transfer: use a dedicated upload service's widget.
- A file browser where people organise what is already stored: use a table or grid view.
Usage
A section in normal page flow.
import Piece from "@/components/propui/03-satchel-upload/Section";
export default function Page() {
return <Piece />;
}Call useSatchel({ accept, maxSize, maxFiles, onUpload }) and render <Satchel satchel={satchel} typesLabel="PDF" />. Replace fakeUpload in data.ts with your uploader: report 0 to 100 through onProgress, resolve when stored, reject with an Error whose message is shown on the row, and stop when signal aborts.
Your data
Replace these and everything on screen follows.
REQUEST{ practice; client; accountant; title; due; accept; typesLabel; maxSize; maxFiles; … }- The page heading, the facts row and the limits Satchel enforces and states.
NEEDS{ id; label; keys: string[] }[]- The requested documents; a file ticks an item off when its name contains one of the keys.
SEEDEDSatchelItem[]- Files already in the list on load (one done, one stopped part way).
SAMPLESSatchelDraft[]- The five sample files that reach every state without a folder to hand.
fakeUploadSatchelUploader- The simulated transfer; swap it for your real one.
SatchelItem{ id; name; size; status; progress; error? }- One row: uploading, done, failed or invalid, with its progress and reason.
Interactions
- Drag files over the drop area (it reads "Release to add N files"), or click it to choose files.
- Watch each file upload on its own line with a percentage; a check draws in when it lands.
- Retry a stopped file, or remove any file; removing an uploading file cancels it.
- Add a wrong type or a file over 20 MB: it stays in the list with the reason and a Remove.
- Add five sample files to see every state at once.
- Send to Ines once nothing is uploading or stopped.
Keyboard
- TaborShift+Tab
- Move between the drop area, each row's Retry and Remove, and Send.
- EnterorSpace
- On the drop area, open the file chooser.
Behaviour
Read from the code: roles, motion, breakpoints and what runs.
Accessibility
- The drop area is a button labelled by its text and described by the stated limits.
- Remove and Retry name the file they act on; after a remove, focus moves to the next row, or back to the drop area.
- Every change (added, uploaded, stopped, refused, removed) is announced in a polite live region.
- Long filenames shorten in the middle and keep the extension; the full name is the row's title.
- Status never rests on colour alone: each row says Uploaded, Stopped at 64% or why it was refused.
Motion
- Each progress line fills on a spring and the percentage is counted from the same value, so they always agree.
- Status text swaps with a short rise and blur; a check draws in when a file lands.
- A stopped file keeps a red partial bar at the point it stopped.
- Reduced motion jumps the bars to their value and removes the movement.
Responsive
- Below 1080px the facts row becomes two columns.
- Below 900px the upload panel moves above the requested documents in one column.
- Below 640px the facts stack, padding tightens, Retry becomes an icon and Send fills the width.
Performance
- Animation runs only while files upload; at rest nothing moves.
- No images: two local font files and inline SVG file sheets.
Notes for AI
Give your coding assistant the Markdown, not a screenshot.
- Keep the limits in one place (REQUEST) and pass them to useSatchel; the stated rules under the drop area read from the same values.
- Drive anything else on the page from satchel.items, as the checklist and tally do, rather than keeping a second list.
- Light only. Keep colours in the tokens at the top of post.css.
/p/satchel-upload/markdownThe whole library for assistants: llms.txt, or the MCP server in AI tools and MCP.