TransferPanel
One file transfer: progress, time left, speed, and buttons to pause, cancel and close. It runs a demo until you pass real values.
UPLOADING…
280.50 GBOF 561.00 GB
PROGRESS 50%
TIME LEFT
00:12:39
UNDER 15 MIN
SPEED
370 MB/s
DETAILS
12,756,809 OF 25,513,618 FILES
FROMLOCAL DISK
TOARCHIVE 02
ACTIONS
Installation
Run this in a project that has a components.json. It adds one file, components/tenor-ui/transfer-panel.tsx, and no packages.
pnpm dlx shadcn@latest add https://tenor.design/r/transfer-panel.jsonNo components.json? Fetch the file. It works in any React project.
curl --create-dirs -o src/components/tenor-ui/transfer-panel.tsx https://tenor.design/r/transfer-panel.tsxUsage
Every prop is optional. With none, it renders the content you see above.
<TransferPanel />"use client";
import * as React from "react";
import { TransferPanel, type TransferPanelStatus } from "@/components/tenor-ui/transfer-panel";
export function ArchiveUpload() {
const [status, setStatus] = React.useState<TransferPanelStatus>("running");
return (
<TransferPanel
transferred={212.75}
total={561}
speed={368}
files={9675210}
totalFiles={25513618}
source="Local disk"
destination="Archive 02"
status={status}
onPause={() => setStatus("paused")}
onResume={() => setStatus("running")}
onCancel={() => setStatus("cancelled")}
onClose={() => setStatus("running")}
/>
);
}Props
| Prop | Type | Default | What it does |
|---|---|---|---|
transferred | number | None | Amount transferred so far, in unit. Leave it out and the panel simulates a transfer. |
defaultTransferred | number | 280.5 | Amount a simulated transfer starts from. |
total | number | 561 | Size of the whole transfer. |
unit | string | "GB" | Unit written after sizes. |
speed | number | 370 | Current speed. A simulated transfer drifts around this figure. |
speedUnit | string | "MB/s" | Unit written after the speed. |
minSpeed | number | 350 | Speed at the bottom of the trace. |
maxSpeed | number | 390 | Speed at the top of the trace. |
secondsLeft | number | None | Seconds left. Defaults to what remains at speed, counting 1000 speed units to one size unit. |
files | number | None | Files transferred so far. Defaults to the share of totalFiles that matches the progress. |
totalFiles | number | 25513618 | Files in the whole transfer. |
source | string | "LOCAL DISK" | Where the files come from. |
destination | string | "ARCHIVE 02" | Where the files go. |
status | "running" | "paused" | "cancelled" | None | Sets the state from outside. Left out, the buttons change it. Complete is reached when transferred meets total. |
labels | Partial<TransferPanelLabels> | transferPanelLabels | Replaces the panel's wording, key by key. |
locale | string | "en-US" | Locale used to format the file counts. |
onPause | () => void | None | Called when the transfer is paused. |
onResume | () => void | None | Called when a paused transfer is resumed. |
onCancel | () => void | None | Called when the transfer is cancelled. |
onClose | () => void | None | Called when the panel is closed. A simulated transfer starts again. |
accent | string | None | Colour of the ruler's leading mark, the percentage and the dot on the trace. |
theme | "dark" | "light" | "dark" | Colour palette. |
It also takes every attribute of its root element, such as className and style.
Theming
Set any of these CSS variables on the component or on an ancestor. Each falls back to the look shown here.
--tui-surface--tui-stroke--tui-text--tui-muted--tui-accent--tui-hover--tui-font-mono