Skip to content
Knowns UI
Get ProSign in

Uploader

A drop area and a managed list in one card. Each file gets a type badge and a row that shows progress with the time left, then ends done, failed with Retry, or rejected with the reason. Uploads run through your own function, a few at a time.

On this page
Used for
  • Attach files to a brief or a ticket
  • Upload a batch of receipts
  • Add source documents to a knowledge base
  • Send assets for review

Examples

Limits
At once

Types, size and count

Your own upload

Controlled

Installation

npx knowns-ui@latest add uploader
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

Props

onUpload
(file, onProgress, signal) => Promise
Defaultsimulated
Sends one file. Call onProgress with 0 to 100, resolve when it is stored, reject to fail the row (the error's message is shown). Abort when signal fires. Left out, a simulated upload runs.
accept
string
Same syntax as <input accept>: ".pdf,image/*". Also filters the picker.
maxSize
number
Bytes. A larger file is listed as rejected: Too large, max 25 MB.
maxFiles
number
Rows the list holds, rejected ones aside. Files past it are listed as rejected.
concurrency
number
Default3
Uploads at once. The rest wait in the queue, in the order they were added.
items / defaultItems
UploadItem[]
The list, controlled (with onChange) or as a start. A row: { id, file, name, size, status, progress, error? }.
onChange
(items) => void
Every change: added, progress, done, failed, retried, removed, cleared.
hint
ReactNode
Defaultfrom the rules
The drop area's second line, e.g. PDF, DOCX, Images up to 10 MB, 6 files max.
label
ReactNode
Default"Drop files here or browse"
The drop area's main line at rest. While files are held over it, it says Drop 3 files.
autoplay
boolean
Defaultfalse
Plays a sample drop of four files once it scrolls into view. Your onUpload is not called for them, and the live region stays quiet until a person acts.
disabled
boolean
Defaultfalse
The drop area and the picker are off.
className
string
On the card.

Keyboard

  • Tab reaches the drop area; Enter or Space opens the file picker.
  • Tab then moves through each row's Retry and Remove, and the footer's Clear.

Accessibility

  • The drop area is a button, described by the hint (the accepted types, the size and the count), so a screen reader hears the rules before picking.
  • Each uploading row has a progressbar named after the file, with its value.
  • Retry and Remove are named after the file (Retry march-ledger.xlsx, Cancel renewal-terms.pdf while it uploads).
  • One polite live region says when a file is uploaded, failed and why, or not added and why; progress ticks are not read out. While autoplay runs by itself it stays quiet.
  • The type badge is decoration: the file name carries the type. A rejected or failed row says why in words, not only in colour.

What it handles

  1. 01Counts the files held over the area and says it (Drop 3 files), with the outline and a faint wash in the ring colour and the three sheets of the icon fanning out.
  2. 02Checks each file against accept, maxSize and the room left under maxFiles, and lists the ones that do not fit as rejected rows with the reason (Too large, max 25 MB), so nothing disappears without a word.
  3. 03Sends files through your onUpload a few at a time (concurrency, default 3) and queues the rest; a rejected promise fails the row with its message and Retry calls onUpload again.
  4. 04Works out the time left from a smoothed upload rate, so the estimate does not jump on every progress event.
  5. 05Aborts a running upload when its row is removed or the uploader unmounts, through the AbortSignal it hands to onUpload.
  6. 06Keeps the footer count (2 of 4 uploaded, 1 failed) and a Clear that removes finished, failed and rejected rows but never a running one.

States

First render
Nothing moves; rows given in items or defaultItems paint as they are
none
Files held over the area
The outline and wash take the ring colour; the back sheets fan out 14 degrees and the front one lifts
280ms, ease in out
Files dropped
Rows rise in one after another, 45ms apart and 240ms at most for the batch
180ms each, ease out
Progress
The bar eases to each new value
280ms, ease in out
Row removed or cleared
It folds away
120ms, ease out
Reduced motion
No fan, no rise; rows and bars change at once
0ms

Works with

When to use

When to use

  • A batch of files sent to your server: the queue, progress with time left, Retry and the reasons for rejected files, managed for you.
  • A form that waits until every attachment is in, with the list in your own state.

When not to use

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Uploader to my app and wire it to my own data.
  • I need a batch of files sent to your server: the queue, progress with time left, Retry and the reasons for rejected files, managed for you. Set that up with the Knowns UI Uploader.
  • Which Uploader props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "uploader" }) and search_docs({ query: "uploader" }).

Need help?

Stuck on Uploader, or found something off? We read every message.