Reputation: 6003
uploadFiles(): void {
const dialogRef = this.dialog.open(AddNewFilesOrImagesComponent, {
width: '620px',
height : '100%',
});
}
if height 100 % UI looks like this(under upload button not necessary empty spaces)
if I put fix height in px(it makes UI scrollable)
uploadFiles(): void {
const dialogRef = this.dialog.open(AddNewFilesOrImagesComponent, {
width: '620px',
height : '250px',
});
}
I want actual this type if I SELECT File it automatic increase its height(when i choose image that time i want to increase automatic height of matdialogbox)
Upvotes: 9
Views: 39823
Reputation: 2814
Add a class to your dialog:
uploadFiles(): void {
const dialogRef = this.dialog.open(AddNewFilesOrImagesComponent, {
panelClass: 'myClass',
});
}
Then add the following style to the class in your CSS:
.myClass {
max-height: 95%;
width: 620px;
overflow-y: auto;
}
Upvotes: 2
Reputation: 9492
The default max height of content of material dialog is 65vh
. It can be increased by styling .mat-dialog-content
::ng-deep {
.mat-dialog-content {
max-height: 90vh;
}
}
Upvotes: 2
Reputation: 6016
Try this, it will take complete height of the page for your matdialog
uploadFiles(): void {
const dialogRef = this.dialog.open(AddNewFilesOrImagesComponent, {
width: '100%',
minHeight: 'calc(100vh - 90px)',
height : 'auto'
});
}
Upvotes: 29
Reputation: 961
The dialog does automatically adapt to the content as long as its html is wrappend inside mat-dialog-content
. :
<h1 mat-dialog-title>{{data.title}}</h1>
<div mat-dialog-content>...>
<div mat-dialog-actions>...>
Upvotes: 4