This component no longer exists. It was in diceui/base’s manifest when we first indexed it and is not there now — the registry served its inventory on 2026-08-13 and this item was not on it. The install command below will fail. It is kept here because a tutorial somewhere still tells people to run it.
file-upload-direct-upload-demo
diceui-base/file-upload-direct-upload-demoRemovedExample
diceui/base publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/sadmann7/diceui/HEAD/docs/public/r/styles/base-vega/file-upload-direct-upload-demo.jsonSource
1"use client";23import { Upload, X } from "lucide-react";4import * as React from "react";5import { toast } from "sonner";6import { Button } from "@/registry/bases/base/ui/button";7import {8 FileUpload,9 FileUploadDropzone,10 FileUploadItem,11 FileUploadItemDelete,12 FileUploadItemMetadata,13 FileUploadItemPreview,14 FileUploadItemProgress,15 FileUploadList,16 type FileUploadProps,17 FileUploadTrigger,18} from "@/registry/bases/base/ui/file-upload";1920export default function FileUploadDirectUploadDemo() {21 const [files, setFiles] = React.useState<File[]>([]);2223 const onUpload: NonNullable<FileUploadProps["onUpload"]> = React.useCallback(24 async (files, { onProgress, onSuccess, onError }) => {25 try {26 // Process each file individually27 const uploadPromises = files.map(async (file) => {28 try {29 // Simulate file upload with progress30 const totalChunks = 10;31 let uploadedChunks = 0;3233 // Simulate chunk upload with delays34 for (let i = 0; i < totalChunks; i++) {35 // Simulate network delay (100-300ms per chunk)36 await new Promise((resolve) =>37 setTimeout(resolve, Math.random() * 200 + 100),38 );3940 // Update progress for this specific file41 uploadedChunks++;42 const progress = (uploadedChunks / totalChunks) * 100;43 onProgress(file, progress);44 }4546 // Simulate server processing delay47 await new Promise((resolve) => setTimeout(resolve, 500));48 onSuccess(file);49 } catch (error) {50 onError(51 file,52 error instanceof Error ? error : new Error("Upload failed"),53 );54 }55 });5657 // Wait for all uploads to complete58 await Promise.all(uploadPromises);59 } catch (error) {60 // This handles any error that might occur outside the individual upload processes61 console.error("Unexpected error during upload:", error);62 }63 },64 [],65 );6667 const onFileReject = React.useCallback((file: File, message: string) => {68 toast(message, {69 description: `"${file.name.length > 20 ? `${file.name.slice(0, 20)}...` : file.name}" has been rejected`,70 });71 }, []);7273 return (74 <FileUpload75 value={files}76 onValueChange={setFiles}77 onUpload={onUpload}78 onFileReject={onFileReject}79 maxFiles={2}80// … truncated
What it pulls in
npm packages
Other registry items
