Angular2 material team recently released the MDDialog https://github.com/angular/material2/blob/master/src/lib/dialog/README.md
I'd like to change the looking and feel about the angular2 material's dialog. For example, to change the fixed size of the popup container and make it scrollable, change the background color, so forth. What's the best way to do so? Is there a css that I can play with?
On smaller screen's like laptop the dialog will shrink. To auto-fix, try the following option
http://answersicouldntfindanywhereelse.blogspot.com/2018/05/angular-material-full-size-dialog-on.html
Additional Reading https://material.angular.io/cdk/layout/overview
Thanks to the solution in answersicouldntfindanywhereelse (2nd para). it worked for me.
Following is needed
import { Breakpoints, BreakpointObserver } from '@angular/cdk/layout'
There are two ways which we can use to change size of your MatDialog component in angular material
1) From Outside Component Which Call Dialog Component
2) From Inside Dialog Component. dynamically change its size
use updateSize() in any function in dialog component. it will change dialog size automatically.
for more information check this link https://material.angular.io/components/component/dialog
Content in
md-dialog-content
is automatically scrollable.You can manually set the size in the call to
MdDialog.open
Further documentation / examples for scrolling and sizing: https://material.angular.io/components/dialog/overview
Some colors should be determined by your theme. See here for theming docs: https://material.angular.io/guide/theming
If you want to override colors and such, use Elmer's technique of just adding the appropriate css.
Note that you must have the HTML 5
<!DOCTYPE html>
on your page for the size of your dialog to fit the contents correctly ( https://github.com/angular/material2/issues/2351 )You can inspect the dialog element with dev tools and see what classes are applied on mdDialog.
For example,
.md-dialog-container
is the main classe of the MDDialog and has padding: 24pxyou can create a custom CSS to overwrite whatever you want
In my opinion this is not a good option and probably goes against Material guide but since it doesn't have all features it has in it's previous version, you should do what you think is best for you.