仕組み
The list only draws what you give it, so it works with any upload method. Speed is an exponential moving average of the change in loaded, so the time left does not flicker. Names keep their extension visible while the middle part ellipsises. The total ignores failed files, so the header never suggests a finish that will not come.
向いている場面
- Uploading several files, or large ones, where people want to see and control each transfer.
- A tray or panel that stays visible while people keep working.
向かない場面
- One small file that finishes in a second: a spinner in the upload button is enough.
- Picking files: use an upload or drop zone, then show this list.
使い方
import { UploadProgressList } from './UploadProgressList.jsx'
// files: [{ id, name, size, loaded, status: 'queued' | 'uploading' | 'paused' | 'done' | 'error', error? }]
export function Uploads({ files, queue }) {
return (
<UploadProgressList
files={files}
onPause={(f) => queue.pause(f.id)}
onResume={(f) => queue.resume(f.id)}
onCancel={(f) => queue.cancel(f.id)}
onRetry={(f) => queue.retry(f.id)}
onRemove={(f) => queue.remove(f.id)}
/>
)
}プロパティ
| プロパティ | 型 | 既定値 | 説明 |
|---|---|---|---|
files | { id, name, size, loaded, status, speed?, error? }[] | — | One entry per file; size and loaded in bytes. status is 'queued', 'uploading', 'paused', 'done' or 'error'. Pass speed (bytes per second) if you know it; otherwise it is measured from loaded and smoothed. |
onPause | (file) => void | — | Shows pause on uploading rows. |
onResume | (file) => void | — | Shows resume on paused rows. |
onCancel | (file) => void | — | Shows cancel on every unfinished row. |
onRetry | (file) => void | — | Shows a labelled Retry button on failed rows. |
onRemove | (file) => void | — | Shows remove on finished rows. |
showSummary | boolean | true | The header with the count, time left and total bar. |
labels | object | — | Replaces built-in text and formatters: title, summary(done, total), left(time), of(a, b), speed(s), queued, paused, done, failed, pause, resume, cancel, retry, remove, formatBytes(n), formatTime(s). |
...rest | HTMLAttributes<HTMLDivElement> | — | Passed to the root. |
アクセシビリティ
- Each row's bar is a progressbar named by the file, with aria-valuetext giving percent, size, speed and time left; the total bar is a progressbar too.
- Icon buttons are labelled with the action and the file name ("Pause site-walkthrough.mp4"); Retry has visible text. All are 32px, 40px on touch.
- The count of finished files is announced in a polite live region.
- Status is never colour alone: a badge, words in the meta line and the bar's pattern (striped when paused) change too. Reduced motion stops the sheen and the bar and badge transitions.
モーション
Fills glide to each new value in 420ms (cubic-bezier(0.25, 0.8, 0.3, 1)) with a sheen passing every 1.6s while uploading. On completion the fill turns green, the badge pops with a 360ms spring and the bar folds away over 320ms. Rows enter rising 6px over 360ms.
プロジェクトに追加
Pro メンバーはプロンプトをコピーし、コーディングエージェントが無料コンポーネントと同じ手順でソースを導入します。
UploadProgressList.jsxupload-progress-list.csstokens.cssREADME.md
2 つのファイルを一緒に導入します。スタイルは tokens.css の変数を読み、予備の値も持つため、単体でも表示できます。





