---
title: "File Upload Queue"
description: "Free React drag and drop upload queue: progress rows, upload states, retry and removal for each file. Framer Motion, Tailwind, shadcn install."
category: "Blocks"
parent: "https://beui.dev/components/blocks/file-upload"
publishedAt: "2026-06-18"
updatedAt: "2026-11-25"
documentation: "https://beui.dev/components/blocks/file-upload/upload-queue"
markdown: "https://beui.dev/components/blocks/file-upload/upload-queue.md"
license: "MIT"
---

# File Upload Queue

> Free React drag and drop upload queue: progress rows, upload states, retry and removal for each file. Framer Motion, Tailwind, shadcn install.

## Install

```bash
npx shadcn@latest add @beui/file-upload
```

## Dependencies

- `@floating-ui/dom`
- `clsx`
- `lucide-react`
- `motion`
- `react`
- `react-dom`
- `tailwind-merge`

## Usage

### Upload Queue usage

A drag-and-drop upload queue with progress rows, upload states, retry, and removal.

```tsx
"use client";

import { RotateCcw } from "lucide-react";
import { useCallback, useEffect, useRef, useState } from "react";
import {
  FileUpload,
  type FileUploadItem,
  type FileUploadVariant,
} from "@/components/motion/file-upload";

const initialItems: FileUploadItem[] = [
  {
    id: "brand-assets",
    name: "brand-assets.zip",
    size: 18_400_000,
    type: "application/zip",
    progress: 100,
    status: "success",
  },
  {
    id: "release-video",
    name: "release-cut.mov",
    size: 84_200_000,
    type: "video/quicktime",
    progress: 58,
    status: "uploading",
  },
  {
    id: "contracts",
    name: "vendor-contract.pdf",
    size: 2_800_000,
    type: "application/pdf",
    progress: 32,
    status: "error",
    error: "Connection lost",
  },
];

const variants: { id: FileUploadVariant; label: string }[] = [
  { id: "centered", label: "Centered" },
  { id: "default", label: "Row" },
];

export function FileUploadPreview() {
  const [items, setItems] = useState(initialItems);
  const [variant, setVariant] = useState<FileUploadVariant>("centered");
  const timersRef = useRef<Map<string, ReturnType<typeof setInterval>>>(
    new Map(),
  );

  const stopUpload = useCallback((id: string) => {
    const timer = timersRef.current.get(id);
    if (!timer) return;
    clearInterval(timer);
    timersRef.current.delete(id);
  }, []);

  const startUpload = useCallback(
    (id: string) => {
      stopUpload(id);

      const timer = setInterval(() => {
        setItems((current) => {
          const target = current.find((item) => item.id === id);
          if (target?.status !== "uploading") {
            stopUpload(id);
            return current;
          }

          const nextProgress = Math.min(
            100,
            (target.progress ?? 0) + 7 + Math.random() * 12,
          );

          if (nextProgress >= 100) {
            stopUpload(id);
          }

          return current.map((item) =>
            item.id === id
              ? {
                  ...item,
                  progress: nextProgress,
                  status: nextProgress >= 100 ? "success" : "uploading",
                }
              : item,
          );
        });
      }, 520);

      timersRef.current.set(id, timer);
    },
    [stopUpload],
  );

  useEffect(() => {
    startUpload("release-video");

    return () => {
      for (const timer of timersRef.current.values()) {
        clearInterval(timer);
      }
      timersRef.current.clear();
    };
  }, [startUpload]);

  return (
    <div className="flex min-h-[30rem] w-full items-center justify-center">
      <div className="w-full max-w-md rounded-[2rem] border border-border bg-background p-3">
        <div className="mb-3 flex flex-wrap items-center justify-between gap-2 px-1">
          <div>
            <p className="text-sm font-medium text-foreground">
              Upload package
            </p>
            <p className="text-xs text-muted-foreground">
              {items.filter((item) => item.status === "success").length} of{" "}
              {items.length} files ready
            </p>
          </div>

          <div className="flex items-center gap-1.5">
            <div className="flex rounded-full border border-border bg-muted p-1">
              {variants.map((entry) => {
                const selected = entry.id === variant;

                return (
                  <button
                    key={entry.id}
                    type="button"
                    onClick={() => setVariant(entry.id)}
                    data-selected={selected}
                    className="h-7 rounded-full px-3 text-xs font-medium text-muted-foreground transition-[background-color,color,transform] duration-150 hover:text-foreground active:scale-95 data-[selected=true]:bg-background data-[selected=true]:text-foreground"
                  >
                    {entry.label}
                  </button>
                );
              })}
            </div>

            <button
              type="button"
              onClick={() => {
                for (const item of items) {
                  stopUpload(item.id);
                }
                setItems(initialItems);
                startUpload("release-video");
              }}
              className="grid h-9 w-9 place-items-center rounded-full border border-border text-muted-foreground transition-colors hover:text-foreground active:scale-95"
              aria-label="Reset upload queue"
            >
              <RotateCcw className="h-3.5 w-3.5" />
            </button>
          </div>
        </div>

        <FileUpload
          value={items}
          variant={variant}
          onValueChange={setItems}
          onFilesAdded={(added) => {
            for (const item of added) {
              startUpload(item.id);
            }
          }}
          onRetry={(item) => startUpload(item.id)}
          onRemove={(item) => stopUpload(item.id)}
          maxFiles={5}
          title={variant === "centered" ? "Drop files to upload" : "Drop release files"}
          description="PDF, images, video or zipped assets"
        />
      </div>
    </div>
  );
}
```

## API Reference

### FileUpload

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `value` | `FileUploadItem[]` | — | No | The file queue, for controlled use. |
| `defaultValue` | `FileUploadItem[]` | — | No | The initial file queue when uncontrolled. |
| `onValueChange` | `((items: FileUploadItem[]) => void)` | — | No | Called with the full queue when files are added, removed or retried. |
| `onFilesAdded` | `((items: FileUploadItem[], files: File[]) => void)` | — | No | Called with the new items and their files after files are added. |
| `onRemove` | `((item: FileUploadItem) => void)` | — | No | Called with the item when its remove button is pressed. |
| `onRetry` | `((item: FileUploadItem) => void)` | — | No | Called with the item, reset to uploading, when its retry button is pressed. |
| `accept` | `string` | — | No | File types the picker allows, as in the input `accept` attribute. |
| `multiple` | `boolean` | `true` | No | Allows picking or dropping more than 1 file at a time. Default: true |
| `maxFiles` | `number` | — | No | Most files allowed in the queue. No limit when unset. |
| `disabled` | `boolean` | `false` | No | Turns off the dropzone and file picker. Default: false |
| `variant` | `"default" \| "centered"` | `default` | No | Dropzone layout: a row, or a stacked and centered block. Default: "default" |
| `title` | `string` | — | No | Heading inside the dropzone. Default: "Drop files here" |
| `description` | `string` | — | No | Line under the dropzone heading. Default: "Add files to the upload queue" |
| `browseLabel` | `string` | — | No | Text on the browse pill. Default: "Browse" |
| `labels` | `Partial<{ title: string; description: string; browse: string; input: string; limitTitle: string; limitDescription: string; queued: string; uploading: string; success: string; error: string; retry: string; remove: string; progress: string; }>` | — | No | Override any built-in string. `{name}` fills the per-file labels; `{count}` and `{max}` fill `limitDescription`. |
| `className` | `string` | — | No | Classes merged onto the root element. |
| `classNames` | `FileUploadClassNames` | — | No | Classes for each part: root, dropzone, queue, item and its inner parts. |

## Types

### FileUploadItem

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | Unique key for the row in the queue. |
| `name` | `string` | Yes | File name shown on the row; its extension picks the icon and kind label. |
| `size` | `number` | Yes | File size in bytes, shown next to the kind label. |
| `type` | `string` | No | MIME type, used for the icon and kind label when the name has no extension. |
| `progress` | `number` | No | Upload progress from 0 to 100. Success always shows 100. Default: 0 |
| `status` | `FileUploadStatus` | No | Upload state; sets the status icon, progress bar and retry button. Default: "queued" |
| `error` | `string` | No | Message shown after the size when the status is `error`. |
| `file` | `File` | No | The picked File, kept for your upload code; the component does not read it. |

### FileUploadClassNames

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `root` | `string` | No | The outer wrapper around the dropzone and queue. |
| `dropzone` | `string` | No | The drop area with the browse pill. |
| `queue` | `string` | No | The list of file rows. |
| `item` | `string` | No | One file row. |
| `leading` | `string` | No | The round file icon at the start of a row. |
| `content` | `string` | No | The column with the name, meta line and progress bar. |
| `name` | `string` | No | The file name text. |
| `meta` | `string` | No | The kind, size and error line under the name. |
| `progress` | `string` | No | The progress bar track. |
| `action` | `string` | No | The retry and remove buttons. |

## More in File Upload

- [Attachment Upload](https://beui.dev/components/blocks/file-upload/attachment-upload.md)

## Source

- Registry detail: https://beui.dev/r/file-upload
- Raw source: https://beui.dev/r/file-upload/raw
- GitHub: https://github.com/starc007/ui-components
