| title | DropFiles | ||||||
|---|---|---|---|---|---|---|---|
| description | Collect local files through a picker, drag and drop, or paste, with removable selections and file-type filtering. | ||||||
| template | doc | ||||||
| layout |
|
||||||
| nav |
|
Add local text, image or PDF files, remove individual entries and inspect the total size. Nothing is uploaded. In single-file mode, the next accepted file replaces the selection.
```html ```Use a hint to explain why selection is unavailable.
All ten tones are visible at once. The control’s label and content explain the intent independently of color.
All eighteen supported treatments, shown in accent. Tone and variant are independent, so any treatment can be combined with a semantic tone.
| Feature | How to try it |
|---|---|
| Picker, drop, paste | All three add local File objects to the same selection. |
| accept | The main demo accepts text, images, and PDF; filtering applies to every entry path. |
| multiple | Toggle multiple files; single mode retains one accepted selection. |
| disabled | Lock the collector; adding and removal are unavailable. |
| File metadata | Each item includes id, file, name, type, size, formatted size, lastModified, and icon. |
| Remove and clear | Remove individual files with their button, or clear the demo list. |
| Empty copy | label, hint, emptyTitle, and emptyText describe the collector before files are added. |
| Icons | uploadIcon, fileIcon, removeIcon, and iconMap choose registered symbols. |
| onChange | Receives the updated selection; this component does not upload files. |
<DropFiles label="Reference files" hint="Images and PDF only"
emptyTitle="Add your references" emptyText="Choose files, drop them, or paste."
accept="image/*,.pdf" :multiple="true" :disabled="locked" :files="files"
uploadIcon="lucide:cloud-upload" fileIcon="lucide:file" removeIcon="lucide:trash"
:iconMap="fileIcons" :context="{ onChange: filesChanged }"/>The drop zone opens the native picker with Enter or Space. File acceptance is a client-side convenience, not server validation. Duplicates are identified from file metadata. onChange runs when the component changes the selection; assigning the files ref yourself is application state management.
DropFiles contract
Props below are the public template API. RefOrValue accepts a literal or a reactive ref; bind refs with a colon-prefixed attribute. Native attributes and events can be passed through the component root.
Writable shallow ref of DropFileItem[]. Each item retains its File plus id, name, type, size, sizeLabel, lastModified and icon.
Comma-separated MIME types, wildcards or extensions; arrays are also accepted. An explicit accept list takes precedence over iconMap keys.
MIME/extension-to-icon map merged with the defaults. When accept is omitted, a supplied map also determines accepted types.
Visible label. Use language that describes the control or value in its surrounding context.
Supporting text beneath the drop-zone instructions.
Drop-zone heading, shown even when files are selected.
Drop-zone instructions.
Disables interaction. Use a bound boolean, for example :disabled="isLocked".
false accepts the first matching file and replaces the current list.
Semantic intent: neutral, accent, secondary, info, success, warning, danger, feature, custom or ghost. The active skin supplies the colors.
Visual treatment. Accepts solid, surface, surfaceAlt, spotlight, glass, flat, flatAlt, flatSolid, outlineFill, outline, subtle, subtleBtn, link, sheen, underline, rail, bracket or none.
Drop-zone icon.
Fallback file icon when no type-specific mapping matches.
Icon on each remove button.
Callback receiving the updated DropFileItem[] after a component-driven change.
No slots. Register defineDropFilesComponents and its icons. Use addDropFiles when another input path needs the same filtering, metadata and deduplication behavior.