You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

ng-files-input

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-files-input

Angular file input component with built-in preview and optional upload support with progress tracking.

2.0.0
latest
Source
npmnpm
Version published
Maintainers
0
Created
Source

npm downloads license build

ng-files-input 📁🖼️

ng-files-input is an Angular library for previewing uploaded files with support for images, PDFs, plain text, and more — all wrapped in a highly customizable and developer-friendly file input component.

✨ Features

  • 📸 Image preview
  • 🎨 Fully customizable UI
  • 🔌 Works with ngModel and FormControl
  • 🧩 Designed for modern Angular (v19+)

📦 Installation

npm install ng-files-input

⚙️ Usage

  • Import the module
import { NgFilesInput, UploadType } from "ng-files-input";

@Component({
  imports: [NgFilesInput],
})
export class ExampleComponent {
  uploadType = UploadType.IMAGE;
}
  • Template Usage
@Component({
  ...
})
export class HomeComponent {
  config = {
    preview: true,
    isValid: (file: File): boolean => {
      return file ? true : false;
    },
    onSelect: (file: File): void => {
      console.log(file);
    },
  };

  modelValueChanged() {
    console.log(this.base64);
  }
}
<ng-files-input [(ngModel)]="base64" (ngModelChange)="modelValueChanged()" [config]="config" accept=".png,.jpg,.jpeg">Upload file</ng-files-input>
  • Style modification
--ng-files-input-width: 220px;
--ng-files-input-height: 180px;
--ng-files-input-background-color: #292826 | #f5f5f5;
--ng-files-input-border-width: 0px;
--ng-files-input-border-style: solid;
--ng-files-input-border-color: #3c3c3c | #e5e5e5;

🚀 Roadmap

  • Drag-and-drop upload
  • Multiple file preview
  • File validation (type/size)
  • Custom preview template slots

📄 License

MIT

👨‍💻 Author

Made with ❤️ by Sanjib Kumar Mandal

Keywords

angular

FAQs

Package last updated on 24 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts