npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

devlab-one-dynamic-modal

v1.0.5

Published

A powerful Angular Material-based Dynamic Popup Library that allows you to open any Angular component as a modal popup with automatic input/output binding, customizable headers, responsive sizing, and lifecycle callbacks.

Downloads

743

Readme

Dynamic Popup Modal

A powerful Angular Material-based Dynamic Popup Library that allows you to open any Angular component as a modal popup with automatic input/output binding, customizable headers, responsive sizing, and lifecycle callbacks.

The library eliminates the need to manually create dialog components, pass data, subscribe to outputs, or manage dialog closing behavior.

Feedback / Suggestion / Report issue

https://github.com/AravindhanSenthilkumar/Feedback/issues/1

Features

  • 🚀 Open any Angular component as a popup
  • 🎨 Angular Material Dialog integration
  • 📥 Pass inputs dynamically
  • 📤 Automatically receive component outputs
  • 🔄 Auto-close support
  • 📏 Configurable width and height
  • 📝 Dynamic header configuration
  • ❌ Close callback support
  • ✅ Submit callback support
  • 🔌 Fully reusable and configurable
  • ⚡ Minimal setup

Installation

npm install devlab-one-dynamic-popup

Inject Modal Service

import { ModalService } from 'devlab-one-dynamic-popup';

constructor(
  private modalService: ModalService
) {}

Open Component as Popup

const modal: IPopupDetails = {
  width: 800,

  component: AnyComponent,

  header: {
    title: 'Form Test Page',
    justification: Justify.left
  },

  contextData: {
    employeeId: 1001,
    employeeName: 'John'
  },

  autoClose: true,

  onClose: () => {
    console.log('Popup Closed');
  },

  onSubmit: (data) => {
    console.log(data);
  }
};

this.modalService.openComponentAsPopup(modal);

Basic Component Example

Popup Component

@Component({
  selector: 'app-user-form',
  templateUrl: './user-form.component.html'
})
export class UserFormComponent {

  @Input() employeeId!: number;

  @Input() employeeName!: string;

  @Output() submitForm = new EventEmitter<any>();

  save() {
    this.submitForm.emit({
      employeeId: this.employeeId,
      employeeName: this.employeeName
    });
  }
}

Passing Inputs

All properties inside contextData are automatically mapped to matching @Input() properties of the component.

contextData: {
  employeeId: 1001,
  employeeName: 'John Doe'
}
@Input() employeeId!: number;

@Input() employeeName!: string;

No manual data injection is required.

Receiving Outputs

Any component output configured as a submit event is automatically captured by the modal service.

@Output()
submitForm = new EventEmitter<any>();
onSubmit: (data) => {
  console.log(data);
}

Result:

{
  employeeId: 1001,
  employeeName: 'John Doe'
}

Auto Close Popup

Enable automatic closing when submit is triggered.

autoClose: true
const modal: IPopupDetails = {
  component: UserFormComponent,
  autoClose: true
};

When the component emits a submit event:

this.submitForm.emit(data);

The popup closes automatically.

Keep Popup Open After Submit

autoClose: false
const modal: IPopupDetails = {
  component: UserFormComponent,
  autoClose: false
};

Useful for:

  • Multi-step forms
  • Validation workflows
  • Save and continue scenarios

Header Configuration

header: {
  title: 'Employee Details',
  justification: Justify.center
}

Available Justifications

export enum Justify {
  left = 'left',
  center = 'center',
  right = 'right'
}

Width Configuration

width: 400
width: 600
width: 1000

The popup width is automatically converted to pixels.

Full Example

const modal: IPopupDetails = {
  width: 800,

  component: EmployeeFormComponent,

  header: {
    title: 'Employee Information',
    justification: Justify.left
  },

  contextData: {
    employeeId: 1001,
    mode: 'edit'
  },

  autoClose: true,

  onClose: () => {
    console.log('Dialog Closed');
  },

  onSubmit: (response) => {
    console.log('Submitted Data');
    console.log(response);
  }
};

this.modalService.openComponentAsPopup(modal);

IPopupDetails

export interface IPopupDetails {
  width?: number;

  component: Type<any>;

  header?: {
    title: string;
    justification: Justify;
  };

  contextData?: any;

  autoClose?: boolean;

  onClose?: () => void;

  onSubmit?: (data: any) => void;
}

Properties

| Property | Description | | ----------- | ------------------------------------- | | width | Popup width in pixels | | component | Angular component to render | | header | Popup header configuration | | contextData | Input values passed to component | | autoClose | Close popup after submit | | onClose | Triggered when popup closes | | onSubmit | Triggered when component emits submit |

Supported Use Cases

  • Dynamic Forms
  • Create/Edit Screens
  • Confirmation Dialogs
  • User Profile Forms
  • Settings Pages
  • Wizard Forms
  • Custom Angular Components
  • CRUD Operations

Lifecycle Flow

Open Popup
      │
      ▼
Create Component
      │
      ▼
Inject Inputs
      │
      ▼
User Interaction
      │
      ▼
Component Emits Output
      │
      ▼
onSubmit Callback
      │
      ▼
Auto Close (Optional)
      │
      ▼
onClose Callback

Built With

  • Angular 21+
  • Angular Material Dialog
  • TypeScript
  • RxJS

License

MIT License