All Projects β†’ peterfreeman β†’ ngx-dropzone

peterfreeman / ngx-dropzone

Licence: other
A highly configurable dropzone component for Angular.

Programming Languages

typescript
32286 projects
HTML
75241 projects
SCSS
7915 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to ngx-dropzone

Angular Filepond
πŸ”Œ A handy FilePond adapter component for Angular
Stars: ✭ 59 (-52.03%)
Mutual labels:  drag-and-drop, upload, file
Angular File Uploader
Angular file uploader is an Angular 2/4/5/6/7/8/9/10 + file uploader module with Real-Time Progress Bar, Responsive design, Angular Universal Compatibility, localization and multiple themes which includes Drag and Drop and much more.
Stars: ✭ 92 (-25.2%)
Mutual labels:  drag-and-drop, upload, file
react-file-input-previews-base64
This package provides an easy to use, ready to go and customizable wrapper around file input, with option for image previews and returning file as base64 string.
Stars: ✭ 15 (-87.8%)
Mutual labels:  upload, file, preview
yii2-dropzone
This extension provides the Dropzone integration for the Yii2 framework.
Stars: ✭ 11 (-91.06%)
Mutual labels:  drag-and-drop, upload, dropzone
react-magic-dropzone
✨Magically drag and drop files/links for uploading
Stars: ✭ 11 (-91.06%)
Mutual labels:  drag-and-drop, upload, dropzone
file-upload-with-preview
πŸ–Ό Simple file-upload utility that shows a preview of the uploaded image. Written in TypeScript. No dependencies. Works well with or without a framework.
Stars: ✭ 406 (+230.08%)
Mutual labels:  upload, file, preview
File Upload With Preview
πŸ–Ό A simple file-upload utility that shows a preview of the uploaded image. Written in pure JavaScript. No dependencies. Works well with Bootstrap 4 or without a framework.
Stars: ✭ 352 (+186.18%)
Mutual labels:  upload, file, preview
Dropzone
Dropzone is an easy to use drag'n'drop library. It supports image previews and shows nice progress bars.
Stars: ✭ 16,097 (+12986.99%)
Mutual labels:  drag-and-drop, dropzone
React Uploady
Modern file uploading - components & hooks for React
Stars: ✭ 372 (+202.44%)
Mutual labels:  drag-and-drop, upload
React Dropzone
Simple HTML5 drag-drop zone with React.js.
Stars: ✭ 8,639 (+6923.58%)
Mutual labels:  drag-and-drop, file
Upload
The file upload extension with insane intelligence for your Flarum forum.
Stars: ✭ 131 (+6.5%)
Mutual labels:  drag-and-drop, upload
Vue Transmit
Vue.js drag & drop uploader based on Dropzone.js
Stars: ✭ 209 (+69.92%)
Mutual labels:  drag-and-drop, upload
Base64 Encoder
Base64 Encoder
Stars: ✭ 245 (+99.19%)
Mutual labels:  drag-and-drop, file
image-uploader
Simple Drag & Drop image uploader plugin to static forms, without using AJAX
Stars: ✭ 70 (-43.09%)
Mutual labels:  drag-and-drop, upload
vue-simple-upload-component
A simple upload component for Vue.js 2.x
Stars: ✭ 14 (-88.62%)
Mutual labels:  drag-and-drop, upload
jquery-xhr-upload-queue
πŸ“‚ A jQuery queued file uploading plugin.
Stars: ✭ 17 (-86.18%)
Mutual labels:  drag-and-drop, upload
svelte-filepond
πŸ”Œ A handy FilePond adapter component for Svelte
Stars: ✭ 188 (+52.85%)
Mutual labels:  upload, file
react-simple-file-input
Simple wrapper for the HTML input tag and HTML5 FileReader API
Stars: ✭ 29 (-76.42%)
Mutual labels:  upload, file
react-drop-n-crop
An opinionated implementation of react-dropzone and react-cropper
Stars: ✭ 17 (-86.18%)
Mutual labels:  drag-and-drop, dropzone
Ngx Material File Input
File input for Angular Material form-field
Stars: ✭ 193 (+56.91%)
Mutual labels:  upload, file

ngx-dropzone

A lightweight and highly customizable Angular dropzone component for file uploads.

NPM Build Status

For a demo see DEMO. And the CODE for the demo.

Install

$ npm install --save ngx-dropzone

Usage

// in app.module.ts
import { NgxDropzoneModule } from 'ngx-dropzone';

@NgModule({
  ...
  imports: [
    NgxDropzoneModule
  ],
  ...
})
export class AppModule { }
<!-- in app.component.html -->
<ngx-dropzone (change)="onSelect($event)">
	<ngx-dropzone-label>Drop it, baby!</ngx-dropzone-label>
	<ngx-dropzone-preview *ngFor="let f of files" [removable]="true" (removed)="onRemove(f)">
		<ngx-dropzone-label>{{ f.name }} ({{ f.type }})</ngx-dropzone-label>
	</ngx-dropzone-preview>
</ngx-dropzone>
// in app.component.ts
files: File[] = [];

onSelect(event) {
  console.log(event);
  this.files.push(...event.addedFiles);
}

onRemove(event) {
  console.log(event);
  this.files.splice(this.files.indexOf(event), 1);
}

You can also use special preview components to preview images or videos:

<ngx-dropzone-image-preview ngProjectAs="ngx-dropzone-preview" *ngFor="let f of files" [file]="f">
  <ngx-dropzone-label>{{ f.name }} ({{ f.type }})</ngx-dropzone-label>
</ngx-dropzone-image-preview>
<ngx-dropzone-video-preview ngProjectAs="ngx-dropzone-preview" *ngFor="let f of files" [file]="f">
  <ngx-dropzone-label>{{ f.name }} ({{ f.type }})</ngx-dropzone-label>
</ngx-dropzone-video-preview>

Component documentation

ngx-dropzone

This component is the actual dropzone container. It contains the label and any file previews. It has an event listener for file drops and you can also click it to open the native file explorer for selection.

Use it as a stand-alone component <ngx-dropzone></ngx-dropzone> or by adding it as an attribute to a custom div (<div class="custom-dropzone" ngx-dropzone></div>). It will add the classes ngx-dz-hovered and ngx-dz-disabled to its host element if necessary. You could override the styling of these effects if you like to.

This component has the following Input properties:

  • [multiple]: Allow the selection of multiple files at once. Defaults to true.
  • accept: Set the accepted file types (as for a native file element). Defaults to '*'. Example: accept="image/jpeg,image/jpg,image/png,image/gif"
  • [maxFileSize]: Set the maximum size a single file may have, in bytes. Defaults to undefined.
  • [disabled]: Disable any user interaction with the component. Defaults to false.
  • [expandable]: Allow the dropzone container to expand vertically as the number of previewed files increases. Defaults to false which means that it will allow for horizontal scrolling.
  • [disableClick]: Prevent the file selector from opening when clicking the dropzone.
  • [id], [aria-label], [aria-labelledby], [aria-describedby]: Forward the accessibility properties to the file input element.
  • [processDirectoryDrop]: Enable extracting files from dropped directories. Defaults to false.

It has the following Output event:

  • (change): Emitted when any files were added or rejected. It returns a NgxDropzoneChangeEvent with the properties source: NgxDropzoneComponent, addedFiles: File[] and rejectedFiles: RejectedFile[].

The RejectedFile extends the native File and adds an optional reason property to tell you why the file was rejected. Its value will be either 'type' for the wrong acceptance type, size if it exceeds the maximum file size or no_multiple if multiple is set to false and more than one file is provided.

If you'd like to show the native file selector programmatically then do it as follows:

<ngx-dropzone #drop></ngx-dropzone>
<button (click)="drop.showFileSelector()">Open</button>

ngx-dropzone-label

This component has no attributes or methods and acts as a container for the label text using content projection. You can place anything inside of it and the text will always be centered.

ngx-dropzone-preview

This component shows a basic file preview when added inside the dropzone container. The previews can be focused using the tab key and be deleted using the backspace or delete keys.

This component has the following Input properties:

  • [file]: The dropped file to preview.
  • [removable]: Allow the user to remove files. Required to allow keyboard interaction and show the remove badge on hover.

It has the following Output event:

  • (removed): Emitted when the element should be removed (either by clicking the remove badge or by pressing backspace/delete keys). Returns the file from the Input property.

The ngx-dropzone-image-preview and ngx-dropzone-video-preview components inherit from this component but expand the preview functionality to display either images or videos directly in the component. See the wiki on how to implement your own custom preview components.

ngx-dropzone-remove-badge

This component is used within the previews to remove selected files. You can use it within your own preview component implementation if you like (see the wiki).

Other

How to upload a file to a Web API?

Licence

MIT Β© Peter Freeman

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].