File Uploader
edgestore/file-uploaderFreeBlock
A component for uploading multiple files with preview and progress indicators.
Install it
npx shadcn@latest add https://edgestore.dev/r/file-uploader.jsonSource
1'use client';23import { cn } from '@/lib/utils';4import {5 AlertCircleIcon,6 CheckCircleIcon,7 FileIcon,8 Trash2Icon,9 XIcon,10} from 'lucide-react';11import * as React from 'react';12import { type DropzoneOptions } from 'react-dropzone';13import { Dropzone } from './dropzone';14import { ProgressBar } from './progress-bar';15import { formatFileSize, useUploader } from './uploader-provider';1617/**18 * Displays a list of files with their upload status, progress, and controls.19 *20 * @component21 * @example22 * ```tsx23 * <FileList className="my-4" />24 * ```25 */26const FileList = React.forwardRef<27 HTMLDivElement,28 React.HTMLAttributes<HTMLDivElement>29>(({ className, ...props }, ref) => {30 const { fileStates, removeFile, cancelUpload } = useUploader();3132 if (!fileStates.length) return null;3334 return (35 <div36 ref={ref}37 className={cn('mt-3 flex w-full flex-col gap-2', className)}38 {...props}39 >40 {fileStates.map(({ file, abortController, progress, status, key }) => {41 return (42 <div43 key={key}44 className="shadow-xs flex flex-col justify-center rounded border border-border px-4 py-3"45 >46 <div className="flex items-center gap-3 text-foreground">47 <FileIcon className="h-8 w-8 shrink-0 text-muted-foreground" />48 <div className="min-w-0 flex-1">49 <div className="flex items-center justify-between text-xs">50 <div className="truncate text-sm">51 <div className="overflow-hidden text-ellipsis whitespace-nowrap font-medium">52 {file.name}53 </div>54 <div className="text-xs text-muted-foreground">55 {formatFileSize(file.size)}56 </div>57 </div>5859 <div className="ml-2 flex items-center gap-2">60 {status === 'ERROR' && (61 <div className="flex items-center text-xs text-destructive">62 <AlertCircleIcon className="mr-1 h-4 w-4" />63 </div>64 )}6566 {status === 'UPLOADING' && (67 <div className="flex flex-col items-end">68 {abortController && (69 <button70 type="button"71 className="rounded-md p-0.5 transition-colors duration-200 hover:bg-secondary"72// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from EdgeStore
All 12 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Dropzonedropzone | EdgeStore | Blocks | Free | 2 deps | |
| File Uploader Blockfile-uploader-block | EdgeStore | Blocks | Free | no deps | |
| Image Uploaderimage-uploader | EdgeStore | Blocks | Free | 2 deps | |
| Multi Image Uploader Blockmulti-image-uploader-block | EdgeStore | Blocks | Free | no deps | |
| Progress Bar Blockprogress-bar-block | EdgeStore | Blocks | Free | no deps | |
| Progress Circle Blockprogress-circle-block | EdgeStore | Blocks | Free | no deps | |
| Single Image Dropzone Blocksingle-image-dropzone-block | EdgeStore | Blocks | Free | no deps |
