Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

acrodata/rnd-dialog

Open more actions menu

Repository files navigation

RnD Dialog

npm license

screenshot

Resizable and draggable dialog based on CDK dialog.

Quick links

Documentation | Playground

Compatibility

Angular @acrodata/rnd-dialog
>=17 0.x

Installation

npm install @acrodata/rnd-dialog --save

Usage

If you use the Material as default lib, you don't need to import any styles.

@import '@angular/cdk/overlay-prebuilt.css';

// or

@use '@angular/cdk' as cdk;

@include cdk.overlay();
import { Component } from '@angular/core';
import { DIALOG_DATA, DialogRef } from '@angular/cdk/dialog';
import { RndDialog, RndDialogDragHandle } from '@acrodata/rnd-dialog';

@Component({
  selector: 'your-app',
  template: `
    <button (click)="openDialog()">Open dialog</button>
  `,
  imports: [],
})
export class YourAppComponent {
  private rndDialog = inject(RndDialog);

  openDialog() {
    this.rndDialog.open(ExampleDialog, {
      data: 'Hello, World!',
      width: '600px',
      height: '400px',
    });
  }
}

@Component({
  selector: 'example-dialog',
  template: `
    <div class="drag-handle" rndDialogDragHandle>
      Drag handle
      <button (click)="dialogRef.close()">close</button>
    </div>
    <p>{{ data }}</p>
  `,
  imports: [RndDialogDragHandle],
})
export class ExampleDialog {
  dialogRef = inject<DialogRef<string>>(DialogRef);
  data = inject(DIALOG_DATA);
}

API

The rnd-dialog simply provides a customized container for CDK dialog, so all APIs are the same with CDK dialog.

License

MIT

Morty Proxy This is a proxified and sanitized view of the page, visit original site.