Skip to content
Browse components

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.json

No 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.tsx

Usage

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

PropTypeDefaultWhat it does
transferrednumberNoneAmount transferred so far, in unit. Leave it out and the panel simulates a transfer.
defaultTransferrednumber280.5Amount a simulated transfer starts from.
totalnumber561Size of the whole transfer.
unitstring"GB"Unit written after sizes.
speednumber370Current speed. A simulated transfer drifts around this figure.
speedUnitstring"MB/s"Unit written after the speed.
minSpeednumber350Speed at the bottom of the trace.
maxSpeednumber390Speed at the top of the trace.
secondsLeftnumberNoneSeconds left. Defaults to what remains at speed, counting 1000 speed units to one size unit.
filesnumberNoneFiles transferred so far. Defaults to the share of totalFiles that matches the progress.
totalFilesnumber25513618Files in the whole transfer.
sourcestring"LOCAL DISK"Where the files come from.
destinationstring"ARCHIVE 02"Where the files go.
status"running" | "paused" | "cancelled"NoneSets the state from outside. Left out, the buttons change it. Complete is reached when transferred meets total.
labelsPartial<TransferPanelLabels>transferPanelLabelsReplaces the panel's wording, key by key.
localestring"en-US"Locale used to format the file counts.
onPause() => voidNoneCalled when the transfer is paused.
onResume() => voidNoneCalled when a paused transfer is resumed.
onCancel() => voidNoneCalled when the transfer is cancelled.
onClose() => voidNoneCalled when the panel is closed. A simulated transfer starts again.
accentstringNoneColour 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