All Components

Dialogs Overview

The Dialog package contains the Dialog and Window components.

Basic Usage

The following example demonstrates the Dialog and Window components in action.

import { Component } from '@angular/core';

@Component({
  selector: 'my-dialogs',
  template: `
  <div class="example-wrapper">
    <button kendoButton *ngIf="!dialogOpened && !windowOpened" (click)="open('dialog')">Open dialog</button>
    <button kendoButton *ngIf="!dialogOpened && !windowOpened" (click)="open('window')">Open window</button>
    <kendo-dialog title="Please confirm" *ngIf="dialogOpened" (close)="close('dialog')" [minWidth]="250" [width]="450">
        <p style="margin: 30px; text-align: center;">Are you sure you want to continue?</p>
        <kendo-dialog-actions>
            <button kendoButton (click)="action('no')">No</button>
            <button kendoButton (click)="action('yes')" primary="true">Yes</button>
        </kendo-dialog-actions>
    </kendo-dialog>

    <kendo-window [minWidth]="200" [minHeight]="125" title="About" *ngIf="windowOpened" (close)="close('window')">
      <p style="text-align: center;">Additional info</p>
    </kendo-window>
  </div>

  `
})
export class DialogsComponent {
  public dialogOpened = false;
  public windowOpened = false;

    public close(component) {
      this[component + 'Opened'] = false;
    }

    public open(component) {
      this[component + 'Opened'] = true;
    }

    public action(status) {
      console.log(`Dialog result: ${status}`);
      this.dialogOpened = false;
    }
}
import { Component } from '@angular/core';

@Component({
    selector: 'my-app',
    template: `<my-dialogs></my-dialogs>`
})
export class AppComponent { }
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DialogsModule } from '@progress/kendo-angular-dialog';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ButtonsModule } from '@progress/kendo-angular-buttons';
import { DialogsComponent } from './dialogs.component';

@NgModule({
  imports:      [ BrowserModule, BrowserAnimationsModule, DialogsModule, ButtonsModule ],
  declarations: [ AppComponent, DialogsComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';

enableProdMode();

const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule);

Installation

Either use the quick setup (Angular CLI v6 or later) or manually add the package (Angular CLI v5 or earlier).

Quick Setup with Angular CLI v6 or Later

Angular CLI v6 supports the addition of packages through the ng add command which executes in one step the set of otherwise individually needed commands.

In order for the Dialogs to properly render their action buttons, import the ButtonsModule.

ng add @progress/kendo-angular-dialog

Manual Setup

All components that you reference during the installation will be present in the final bundle of your application. To avoid ending up with components you do not actually need, either:

  • Import all Dialog components at once by using the DialogsModule, or
  • Import a specific component by adding it as an individual NgModule.

  1. Download and install the package.

    npm install --save @progress/kendo-angular-dialog @progress/kendo-angular-buttons @progress/kendo-angular-l10n
  2. For Angular 6, install the rxjs-compat package. For more information, refer to the article on upgrading to Angular 6.

    npm install --save rxjs-compat@6

    For Angular 5 or earlier, install RxJS v5.5+.

    npm install --save rxjs@^5.5
  3. Once installed, import the NgModule of the components you need.

    To get all package components, import the DialogsModule in your application root or feature module.

    import { NgModule } from '@angular/core';
       import { BrowserModule } from '@angular/platform-browser';
       import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
       import { DialogsModule } from '@progress/kendo-angular-dialog';
       import { AppComponent } from './app.component';
    
       @NgModule({
           bootstrap:    [AppComponent],
           declarations: [AppComponent],
           imports:      [BrowserModule, BrowserAnimationsModule, DialogsModule]
       })
       export class AppModule {
       }

    The package also exports the following modules for individual components:

    • DialogModule
    • WindowModule

    To reduce the size of your application, include only the ones you need.

    import { NgModule } from '@angular/core';
       import { BrowserModule } from '@angular/platform-browser';
       import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
       import { AppComponent } from './app.component';
    
       // Imports the Dialog
       import { DialogModule } from '@progress/kendo-angular-dialog';
    
       @NgModule({
           bootstrap: [AppComponent],
           declarations: [AppComponent],
           imports: [BrowserModule, BrowserAnimationsModule, DialogModule]
       })
       export class AppModule {}
  4. You are required to install one of the Kendo UI themes for Angular to style your components. For more information on how to add the styles, refer to the section on styling.

Dependencies

The Dialogs require you to install the following peer dependencies in your application:

  • @angular/animations
  • @angular/common
  • @angular/core
  • @progress/kendo-angular-l10n
  • @progress/kendo-angular-buttons
  • rxjs

The Dialog package utilizes the Angular animation system, which supports a specific set of browsers.

In this article