Vue playground

Nova v3.37.0

Preview

Vue

File upload

nv-fileupload

A labelled field that collects files through a dropzone, checks them and lists them as file tiles, while your application uploads them.

Parts

Live demo

Size

Overview

Use file upload when a form needs one or more files. It combines a dropzone with a list of file tiles, checks each file, and keeps the list in files. It never sends anything: your application uploads each accepted file and writes its state, progress and message back into files.

Anatomy

A file upload with six callouts: 1 marks the dropzone, 2 its helper text, 3 a completed file tile, 4 an upload progress bar showing 46%, 5 a rejected file, and 6 the summary below the list.

The parts of a file upload, with completed, uploading and rejected files.
  1. Dropzone accepts files from a picker, drag and drop, or paste.
  2. Helper text gives the constraints from accept, maxFileSize (in MB) and maxFiles, such as "up to 10 files".
  3. File tile shows a file's name, size, state and available action. Accepted files start queued until your application updates them.
  4. Progress bar shows the upload's progress while its state is uploading.
  5. Rejected file stays in the list as invalid with the reason, such as "File too large — max 1 MB".
  6. Summary appears when something went wrong, for example "1 file couldn't be added".

Properties

Design settingCodeMapping
Sizesizemd or compact sm.
File listfilesItems contain id, name, byte size, type, state, progress and message.
Helper textaccept, maxFileSize, maxFiles, helperTextGenerated from constraints unless overridden; the size limit is in MB.
Instruction / browse labelinstruction, browseLabelKeep {browse} where the picker link belongs.
Drop instructiondropInstructionReplaces the instruction during drag-over.
Tile stateEach item's statequeued, uploading, processing, complete, error, invalid.
Disabled / read-onlydisabled, readonlyDisable actions, or display the list without the dropzone and actions.
Feedback summaryGeneratedReports rejected files and upload failures.
Form and input behaviormultiple, required, disablePasteMultiple selection, completed-file requirement, and clipboard control.
Field content / languagelabel, description, localeField context and localized built-in text.

A label and description can introduce the field through props or the label and description slots.

label, description and constraints from accept, maxFileSize and maxFiles

Look and feel

File tile states

StatePresentation and action
QueuedWaiting to start; remove action.
UploadingMeasured progress; cancel action.
ProcessingIndeterminate progress while the server works; no action.
CompleteConfirmation icon; remove action.
ErrorFailure message, retry and remove.
InvalidRejection reason and remove; retry is not offered.
DisabledExisting actions remain visible but cannot be used.
Read-onlyFile information without actions.

Disabled and read-only are component properties, not additional state values. The file tile overview illustrates the individual states.

Dropzone states

The zone has a resting appearance, drag-over instruction, keyboard focus ring and disabled state. In multiple mode, reaching maxFiles with accepted (non-invalid) entries disables further selection. Choose sm for narrow or dense layouts; md is the default. Both sizes follow Spark and Ocean in light and dark mode.

Behavior

  1. Files arrive through the picker, a drop or paste.
  2. Type and size validation produce invalid entries with specific messages; otherwise-valid files beyond the count limit are not added.
  3. Accepted entries become queued. filesAdded carries a files array of { id, file } pairs for the application to upload.
  4. The application writes progress and state back to files, and explicitly sets complete only after server confirmation. Reaching 100% is not enough.
  5. Cancel, remove and retry emit fileCancelled, fileRemoved and fileRetried; the application handles the request lifecycle. List changes emit the complete updated array through filesChanged.

Without multiple, selecting another file replaces the current one. required keeps the form invalid until at least one file is complete. Authentication, storage and retry policy belong to the application.

Accessibility

The native file picker provides a keyboard alternative to drag and drop. Tile actions are buttons named for their file, and a tile's message is associated through aria-describedby. The summary uses a polite status region to announce list-level failures.

Content

Name the violated constraint, such as “Maximum file size: 25 MB”, and explain what users can change. Keep custom instructions short and retain {browse}. Built-in text and size formatting use English, French, Dutch or German; unsupported languages fall back to English.

Usage

Treat validation rejection as invalid, with a specific reason and Remove. Use error and Retry for upload failures that another attempt could resolve. Avoid vague messages or retry actions on permanently unacceptable files.

Tokens

Spacing is grouped under file-upload-{sm,md}-gap-y, file-upload-file-list-{sm,md}-gap-y, and the file-upload-dropzone-*, file-upload-file-tile-* and file-upload-feedback-message-* families for padding, gaps and radii.

Related

The composition combines Dropzone, File tile and Progress bar. In Blazor, NvInputFile provides IBrowserFile values for application-side uploads; see the framework examples.

Sources