angular material file input component supports file drag and drop, and selection with native file picker
npm install ngx-file-drag-drop#### Check out the Demo
```
npm i ngx-file-drag-drop
selector:
implements: ControlValueAccessor to work with angular forms
Additionnal properties
| Name | Description |
| -------------------------------------------------------- | ------------------------------------------------------------------------ |
| _@Input()_ multiple: boolean | Allows multiple file inputs, false by default |string
| _@Input()_ accept: | Any value the native accept attribute can get. Doesn't validate input. |boolean
| _@Input()_ disabled: | Disable the input. |string
| _@Input()_ emptyPlaceholder : | Placeholder for empty input, default Drop file or click to select |boolean
| _@Input()_ displayFileSize : | Show file size in chip rather than in tooltip, default false |string
| _@Input()_ activeBorderColor: | A css color for when file is dragged into drop area, default purple |EventEmitter
| _@Output()_ valueChanged: | Event emitted when input value changes |(files: File[] \| FileList \| File) => void
| addFiles(): | Update input |(file:File) => void
| removeFile(): | Removes the file from the input |() => void
| clear(): | Removes all files from the input |File[]
| files: | Getter for form value |boolean
| isEmpty: | Whether the input is empty (no files) or not |
Usage:
`html`
{{ 104857600 | byteFormat }}
_Output:_ 100 MB
`ts`
import { FileValidators } from "ngx-file-drag-drop";
| Validator | Description |
| ------------------------------------- | -------------------------------------- |
| uniqueFileNames | Disallow two files with same file name |fileExtension(ext: string[])
| | Required file extensions |fileType(types: string[] \| RegExp)
| | Required Mime Types |maxFileCount(count: number)
| | Max number of files |maxFileSize(bytes: number)
| | Max bytes allowed per file |maxTotalSize(bytes: number)
| | Max total input size |required` | At least one file required |
|