Forms Core Stable

FileUpload

A drop zone backed by a native file input, with per-file progress, JS-side validation and a removable file list

Preview

Installation

pnpm add fancy-ui-svelte
import { FileUpload } from 'fancy-ui-svelte'

Usage

svelte
<script lang="ts">
  import { FileUpload } from 'fancy-ui-svelte';
</script>

<FileUpload />

Examples

Basic Usage

Multiple, With Progress

Driving status/progress from an onFilesChange callback with a simulated upload.

Constraints

accept, maxSize and maxFiles all enforced in JS on both the picker and a drop.

With FormField

Props

PropTypeDefaultDescription
files UploadFile[][]Selected files; bindable
onFilesChange (files: UploadFile[]) => void-Called with the new list on every change — a selection, a drop, or a removal
accept string-The input's native accept attribute; also enforced in JS since a dropped file bypasses it
multiple booleanfalseAllows more than one file per selection or drop
maxSize number-Maximum size per file, in bytes. A larger file is added with status "error"
maxFiles number-Maximum number of files the list may hold. Extra files are rejected, not added
disabled booleanfalseBlocks selecting, dropping and removing files
required booleanfalseNative required on the underlying input
invalid booleanfalseDrives the error border and aria-invalid
id string-Element id, applied to the underlying file input
name string-Native name on the underlying input
label string-Accessible name — for a control with no visible Label next to it
hint string-Constraint text under the drop zone, e.g. "PNG, SVG — 4 MB max"
class string-Additional CSS classes
ref HTMLInputElement | nullnullBindable reference to the underlying file input