Installation
Uplofile is a composable file upload component for React. It allows you to build your own UI with small, accessible primitives: context‑driven Root, Trigger, Dropzone, Preview, and helpers for cancel/retry/remove — with progress and drag‑and‑drop.
- React 16+ compatible
- Drag & drop, click‑to‑upload, and render‑props APIs
- Progress, cancel, retry, and optimistic/strict remove flows
- Hidden input with JSON of successful uploads for regular form submits
- You can style however you like (Tailwind recommended)
Install
Section titled “Install”You can add Uplofile to your project site by installing the uplofile package. Follow these steps:
-
Select your package manager:
Terminal window npx add uplofileTerminal window pnpm add uplofileTerminal window yarn add uplofile -
Create a file
file-uploader.tsxin yoursrc/componentsdirectory -
Copy and paste the following code:
file-uploader.tsx "use client";import * as FileUploaderPrimitive from "uplofile";const FileUploader = FileUploaderPrimitive.Root;const FileUploaderTrigger = FileUploaderPrimitive.Trigger;const FileUploaderInput = FileUploaderPrimitive.HiddenInput;const FileUploaderDropzone = FileUploaderPrimitive.Dropzone;const FileUploaderPreview = FileUploaderPrimitive.Preview;const FileUploaderCancel = FileUploaderPrimitive.Cancel;const FileUploaderRetry = FileUploaderPrimitive.Retry;export {FileUploader,FileUploaderTrigger,FileUploaderInput,FileUploaderDropzone,FileUploaderPreview,FileUploaderCancel,FileUploaderRetry,}; -
Then import and use in your app.
-
You’re done! 🎉
Styling
Section titled “Styling”- Bring your own styles or Tailwind. The package includes default styles with Tailwind.