File Uploader
Drag-and-drop file upload component with progress bars, file type validation, and direct S3/R2 integration. Supports multi-file uploads and image previews.
ReactUI ComponentsBuilt with Copilot
1.4k
Stars
7.2k
Installs
2
Deps
2
Comments
Install / Copy
npx create-freestack-module file-uploaderCode Preview
index.tsx
import { useDropzone } from "react-dropzone";
export function FileUploader({ onUpload, maxSize = 10_000_000 }) {
const [files, setFiles] = useState([]);
const [progress, setProgress] = useState({});
const { getRootProps, getInputProps, isDragActive } = useDropzone({
onDrop: (accepted) => {
setFiles((prev) => [...prev, ...accepted]);
accepted.forEach((file) => uploadFile(file, setProgress));
},
maxSize,
accept: { "image/*": [], "application/pdf": [] },
});
return (
<div {...getRootProps()} className="cursor-pointer rounded-lg border-2 border-dashed p-8 text-center">
<input {...getInputProps()} />
{isDragActive ? <p>Drop files here...</p> : <p>Drag files or click to upload</p>}
<FileList files={files} progress={progress} />
</div>
);
}S3
s3guru6 days ago
Swapped S3 for R2 in about 10 lines. The abstraction layer is well designed.
MO
mobilefirst1 week ago
Works well on mobile too. The touch-based drag area is responsive.
Related Modules
Kanban Board
Drag-and-drop Kanban board with real-time sync via WebSockets. Supports multiple boards, swimlanes, card assignments, and priority labels out of the box.
2.3kReact
Data Table Pro
Full-featured data table with sorting, filtering, pagination, column resizing, and CSV export. Built on TanStack Table with a clean, customizable UI.
1.9kReact
Rich Text Editor
Notion-style block editor with slash commands, drag-to-reorder, markdown shortcuts, and collaborative editing support. Built on Tiptap with custom extensions.
4.1kReact