Skip to content

Upload

A simple file upload component with drag-and-drop support and a file list.

Demo

Default

Click the dropzone or drag a file onto it.

Choose a file or drag and drop here


With Label & Hint

Use label and hint to give users context about what to upload.

PNG, JPG, SVG up to 5 MB
Choose a file or drag and drop here


Multiple Files

Set multiple to allow selecting more than one file at a time.

Choose a file or drag and drop here


Validation States

Use validation and message to communicate errors, warnings, or success.

Choose a file or drag and drop here
File size exceeds the 5 MB limit.
Choose a file or drag and drop here
This file type may not be supported.
Choose a file or drag and drop here
File uploaded successfully.


Compact

Use is-compact for a reduced-height inline dropzone.

Choose a file or drag and drop here


Disabled

The disabled prop prevents interaction.

Choose a file or drag and drop here

Install

bash
npm i @vuesimple/vs-upload

Usage

html
<template>
  <vs-upload v-model="files" label="Upload a file" multiple />
</template>

<script>
  import VsUpload from '@vuesimple/vs-upload';
  validation;
  export default {
    components: { VsUpload },
    data() {
      return { files: [] };
    },
  };
</script>

CDN

html
<script src="https://cdn.jsdelivr.net/npm/@vuesimple/vs-upload@3.1.6/dist/index.min.js"></script>
javascript
// Main/Entry file
app.use(VsUpload.plugin);
html
<template>
  <vs-upload v-model="files" />
</template>

Props

NameTypeDefaultOptionsDescription
modelValueArray[]v-model binding; array of File objects
labelStringLabel displayed above the dropzone
hintStringHint text displayed below the label
acceptStringAny valid MIME type or extRestricts the accepted file types
multipleBooleanfalseAllows selecting multiple files
disabledBooleanfalseDisables the component
isCompactBooleanfalseRenders a smaller inline dropzone
validationStringsuccess, warning, errorApplies a validation state to the dropzone
messageStringValidation message shown below the dropzone

Emits

EventPayloadDescription
update:modelValueFile[]Emitted when files are added or removed (v-model)
changeFile[]Emitted when the file list changes
rejectReserved for future file-rejection callbacks

Theming (CSS variables)

VariableDefaultDescription
--vs-upload-label-color#2f3941Label text color
--vs-upload-hint-color#68737dHint text color
--vs-upload-dropzone-border#d8dcdeDropzone border color
--vs-upload-dropzone-bg#ffffffDropzone background
--vs-upload-dropzone-color#1f73b7Dropzone icon and text color
--vs-upload-dropzone-border-dragging#1f73b7Border color when a file is dragged over
--vs-upload-dropzone-bg-dragging#eaf4ffBackground when a file is dragged over
--vs-upload-file-border#e9ebedFile item border color
--vs-upload-file-bg#ffffffFile item background
--vs-upload-file-color#2f3941File item text color
--vs-upload-file-size-color#87929dFile size text color
--vs-upload-remove-color#cc3340Remove button color
--vs-upload-remove-hover-color#8c232cRemove button hover color