File Upload

A component for creating drag-and-drop file upload interfaces with support for single or multiple files, custom triggers, and visual feedback during file dragging operations.

Examples

File Upload with Prompt Input

You can combine the file upload component with the Prompt Input component to create a full-featured input component with file upload support. You can try to drop a file to see the visual feedback.

Installation

npx shadcn add "https://prompt-kit.com/c/file-upload.json"

Component API

FileUpload

PropTypeDefaultDescription
onFilesAdded(files: File[]) => voidFunction called when files are added
childrenReact.ReactNodeChild components
multiplebooleantrueAllow selection of multiple files
acceptstringFile types to accept (e.g., ".jpg,.png")

FileUploadTrigger

PropTypeDefaultDescription
asChildbooleanfalseUse child element as the trigger
classNamestringAdditional CSS classes
childrenReact.ReactNodeChild components
...propsReact.ComponentPropsWithoutRef<"button">All other button props

FileUploadContent

PropTypeDefaultDescription
classNamestringAdditional CSS classes
...propsReact.HTMLAttributes<HTMLDivElement>All other div props