Dropzone components allow users to upload files via drag and drop or file selection.
Prop | Type | Default |
|---|---|---|
No dataThere are no records to display | ||
Each file in the files array follows this structure:
Prop | Type | Default |
|---|---|---|
No dataThere are no records to display | ||
The accept prop allows you to specify which file types are allowed:
accept="image/*" - All image typesaccept=".pdf,.doc,.docx" - Specific file extensionsaccept="image/png,image/jpeg" - Specific MIME types<script lang="ts">
import { Dropzone } from 'ui-svelte';
let files = $state([]);
function handleChange(newFiles) {
console.log('Files uploaded:', newFiles);
}
</script>
<Dropzone
name="documents"
label="Upload Documents"
accept=".pdf,.doc,.docx"
multiple={true}
helpText="PDF, DOC, or DOCX files only"
onchange={handleChange}
bind:files
/>