Forms
FileUpload
Drag-and-drop file upload with image previews, multiple file support, area/button variants, and list/grid layouts.
Playground
Experiment with different props in real-time.
Drop files here or click to upload
Basic Usage
Drop zone with file preview.
Drop files here or click to upload
<script lang="ts">
import { FileUpload } from 'sv5ui';
let files = $state<File[]>([]);
</script>
<FileUpload bind:value={files} />Multiple Files
Allow selecting multiple files.
Drop files here or click to upload
You can upload multiple files at once
<FileUpload multiple label="Drop files here or click to upload" description="You can upload multiple files at once" />Accept Types
Filter by MIME type or extension.
Upload images
PNG, JPG, GIF up to 10MB
Upload document
PDF files only
<!-- Images only -->
<FileUpload accept="image/*" label="Upload images" description="PNG, JPG, GIF up to 10MB" />
<!-- PDF only -->
<FileUpload accept=".pdf" label="Upload document" description="PDF files only" />
<!-- Multiple types -->
<FileUpload accept="image/*,.pdf,.doc,.docx" label="Upload files" description="Images, PDF, or Word documents" />Variants
Area (dropzone) or button style.
Drop files here
<!-- Area variant (default) — dropzone style -->
<FileUpload variant="area" label="Drop files here" />
<!-- Button variant — compact trigger -->
<FileUpload variant="button" label="Choose file" />Sizes
SM upload
MD upload
LG upload
<FileUpload size="sm" label="Small upload" />
<FileUpload size="md" label="Medium upload" />
<FileUpload size="lg" label="Large upload" />Layout
List or grid file display.
List layout
Grid layout
<!-- List layout (default) -->
<FileUpload layout="list" multiple label="List layout" />
<!-- Grid layout -->
<FileUpload layout="grid" multiple accept="image/*" label="Grid layout" />Custom Labels
Upload your avatar
Recommended: 400x400px, PNG or JPG
<FileUpload
icon="lucide:image"
label="Upload your avatar"
description="Recommended: 400x400px, PNG or JPG"
accept="image/*"
/>Loading & Disabled
Uploading...
Upload disabled
<FileUpload loading label="Uploading..." />UI Slots
Use the ui prop to override classes on internal elements.
| Slot | Description |
|---|---|
root | Root container |
base | Upload area base |
wrapper | Content wrapper |
icon | Upload icon |
label | Label text |
description | Description text |
actions | Actions container |
files | File list container |
file | Individual file item |
fileLeading | File item icon/preview |
fileName | File name text |
fileSize | File size text |
fileTrailing | File item buttons |
Snippets
| Snippet | Description |
|---|---|
leadingSlot | Custom icon/avatar in upload area |
labelSlot | Custom label text |
descriptionSlot | Custom description text |
actionsSlot | Custom action buttons (receives open function) |
filesSlot | Replace entire file list (receives files) |
fileSlot | Custom file item (receives file, index, remove) |
children | Additional content in upload area |
Props
| Prop | Type | Default |
|---|---|---|
value | File[] | [] |
multiple | boolean | false |
accept | string | - |
variant | 'area' | 'button' | 'area' |
color | ColorType | 'primary' |
size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'md' |
layout | 'list' | 'grid' | 'list' |
label | string | 'Drop files here...' |
description | string | - |
icon | string | 'lucide:upload' |
dropzone | boolean | true |
interactive | boolean | true |
preview | boolean | true |
imagePreview | boolean | true |
highlight | boolean | false |
loading | boolean | false |
disabled | boolean | false |
required | boolean | false |
ref | HTMLElement | null | null |
class | string | - |
ui | Record<Slot, Class> | - |