115 Components
File Drop Zone
MotionAn illustrated file upload card built around an animated folder. The folder opens when you drag a file over it, the paper sinks in as the upload progresses, and a green check pops on when it finishes.
MotionTailwindInteractiveSVG
drop files to uploador click to browse
Installation
Install directly into your project using the shadcn CLI or copy the source code manually.
Requires:framer-motionclsxtailwind-merge
$npx shadcn@latest add "https://boseui.site/r/file-drop-zone.json"
Props
TypeScript props supported by <FileDropZone />.
| Prop | Type | Default | Description |
|---|---|---|---|
| onUpload | (files: File[], onProgress: (loadedBytes: number) => void, signal: AbortSignal) => Promise<void> | undefined | Performs the real upload. Call onProgress with bytes sent as it proceeds, resolve when done, or reject to show the error state. When omitted, a simulated upload runs instead |
| accept | string | undefined | Passed to the native file input to filter the browse dialog, for example "image/*,.pdf" |
| multiple | boolean | true | Allow more than one file per drop or selection. When false, only the first file is used |
| showSamples | boolean | true | Shows the "or try sample files" link under the card, which runs a demo upload |
| resetAfter | number | 2500 | Milliseconds to stay on the success state before returning to idle. Use 0 to keep it |
| className | string | "" | Optional Tailwind classes applied to the outer wrapper |
Key Features
- Five clear states: idle, dragging, uploading, done and error, each with its own folder animation and copy
- Folder flap lowers and the paper rises out when a file is dragged over the card
- Upload progress traces the card border while the paper sinks into the folder
- Success check badge that springs in and draws itself
- Drag and drop, click to browse, and keyboard activation all supported
- Works out of the box with a simulated upload, or pass onUpload to connect a real one
- Vector SVG folder that stays sharp at any size, with light and dark mode styles
Keyboard & Accessibility
- Respects prefers-reduced-motion: transitions and the check animation become instant
- The card is a focusable role="button" that opens the file browser with Enter or Space
- Visible focus-visible ring on the card and on the sample files link
- Status text is announced politely to screen readers through aria-live
- aria-disabled is set while an upload is in progress, and drops are ignored
- Decorative folder and progress graphics are marked aria-hidden