Upload List
Files in flight, with per-file progress and a retry for the ones that failed. A failed upload keeps its row rather than vanishing — silently dropping it is how people lose work.
src/components/ui/upload-list.tsxAbout
From the component's own source, where it was written.
A batch of uploads with an aggregate bar.
Overall progress is weighted by file size, not by count. Five thumbnails and one video are not six equal sixths, and a per-file average sits at 83% while the only file that matters has barely started.
Failures stay in the list with a retry. Dropping them silently is how a user ends up believing an upload finished; the failed row is the notification.
Install
npx astralyx-ui add upload-list
Usage
import { UploadList } from '@/components/ui/upload-list'
<UploadList uploads={uploads} onRetry={retry} onRemove={remove} onCancelAll={cancel} />Composer
Change the props and the source below follows.
quarterly-report-final-v4.pdf
4.0 MB72%hero-render.psd
176 MB18%notes.txt
2.0 KBarchive.zip
488 MBExceeds the 200 MB limit
<UploadList uploads={uploads} onRetry={retry} onRemove={remove} />API
Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.
UploadList
A batch of uploads with an aggregate bar.
Extends Omit<ComponentProps<'div'>, 'children'>.
| Prop | Type | Default | Description |
|---|---|---|---|
| uploads | Attachment[] | required | The same shape AttachmentPreview takes, so one list can carry files mid-upload and files already attached. |
| onRetry | (id: string) => void | — | Shown only on rows with an error. |
| onRemove | (id: string) => void | — | — |
| onCancelAll | () => void | — | Appears while anything is still uploading. Omit for a list that cannot be interrupted. |
| cancelAllLabel | ReactNode | 'Cancel remaining' | — |
| summary | derived | — | Overall progress is weighted by file size, not by count — 3 of 4 files done means little when the fourth is 180 MB. |