There are a couple of ways you can adjust the size of your MatDialog component in Angular Material.
1) Changing Size from Outside Component Calling Dialog Component
import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material';
dialogRef: MatDialogRef <any>;
constructor(public dialog: MatDialog) { }
openDialog() {
this.dialogRef = this.dialog.open(TestTemplateComponent, {
height: '40%',
width: '60%'
});
this.dialogRef.afterClosed().subscribe(result => {
this.dialogRef = null;
});
}
2) Adjusting Size from Inside Dialog Component to dynamically change its dimensions
import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material';
constructor(public dialogRef: MatDialogRef<any>) { }
ngOnInit() {
this.dialogRef.updateSize('80%', '80%');
}
You can use updateSize() within any function in the dialog component to automatically change the dialog size.
For more information, refer to https://material.angular.io/components/component/dialog