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.

Installation

pnpm dlx shadcn-svelte@latest add http://sveltekit-prerender/r/file-upload.json

Props

FileUpload

PropTypeDefaultDescription
onFilesAdded(files: File[]) => void-Called after the user selects or drops files.
childrenSnippet-Upload trigger, content overlay, and surrounding UI.
multiplebooleantrueAllow selecting more than one file.
acceptstring-Accepted file types, for example `".png,.pdf"`.
disabledbooleanfalseDisable drag-and-drop handling and file input activation.

FileUploadTrigger

PropTypeDefaultDescription
asChildbooleanfalseRender the trigger behavior on a wrapper element instead of a native button.
childrenSnippet-Trigger label, icon, or custom button content.
classstring-Additional CSS classes for the trigger wrapper or button.
onclick(event: MouseEvent) => void-Optional click handler called after the file input is opened.

FileUploadContent

PropTypeDefaultDescription
childrenSnippet-Overlay content shown while files are being dragged over the window.
classstring-Additional CSS classes for the drag overlay.