Angular playground

Nova v3.37.0

Preview

Angular

Dropzone

nv-dropzone

A bordered area where people drop, paste or browse for files, which hands the raw files to your application.

Parts

Live demo

Size
Locale

Overview

Use a dropzone where people add files: they drop files on it, click it to open the file picker, or paste a file while it has focus. Every route emits the same filesSelected event with the raw files. The dropzone keeps no list, doesn't validate and doesn't upload. For a list, checks and upload status, use file upload.

Anatomy

The file upload anatomy shows the dropzone and its helper text above the file list in the upload composition.

Parts

  1. Illustration: a stack of cards with an upload icon at the default md size, or a small icon at sm. The icon slot replaces it.
  2. Instruction: "Drag and drop or choose a file" by default. instruction changes it, and {browse} marks where the browse link (browseLabel) goes.
  3. Helper text (optional): constraints such as file types or size.
md · default
size="sm"
disabled

States and themes

Default shows the instruction and helper text. Drag-over replaces the instruction with dropInstruction; keyboard focus adds a focus ring. Disabled blocks click, drop and paste. In multiple mode, file upload also disables its composed dropzone when accepted (non-invalid) entries reach the count limit. Both sizes support Spark and Ocean in light and dark mode.

Accessibility

A native file input supplies keyboard access; picking files is always an alternative to dragging. The instruction labels the input, and helper text is associated with it. Keep the browse action and meaningful constraints when providing custom content.

Usage

  • Say which files are welcome in the helper text. accept only filters the file picker; dropped and pasted files arrive unfiltered, so check them yourself.
  • Without multiple, only the first file is kept.
  • locale translates the built-in texts into English, French, Dutch or German.
  • disabled blocks every route; disablePaste turns off pasting only.
DoSay which files are welcome before people choose one.
Don'tAvoid leaving file types and limits unstated.

Sources