Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Material theming / changing border radius

I am using Angular Material with a theme.

$my-theme-redish: (...
$my-theme-red: (...
$my-theme-celeste: (...

$my-theme-primary: mat-palette($my-theme-redish);
$my-theme-accent:  mat-palette($my-theme-celeste);
$my-theme-warn:    mat-palette($my-theme-red);

$my-app-theme: mat-light-theme((
  color: (
    primary: $my-app-primary,
    accent: $my-app-accent,
    warn: $my-app-warn,
  )
));

Now I also want to theme/change the border-radius. Can I do this in theming? I did not find any documentation on this.

I tried theming by using ::ng-deep or directly adressing certain components:

::ng-deep mat-dialog-container {
  border-radius: 20px !important;
}

But nothing worked.

like image 796
Andresch Serj Avatar asked Apr 22 '26 09:04

Andresch Serj


2 Answers

For angular V16 add in your custom-theme.scss or in styles.css

 .mat-mdc-dialog-container {
  --mdc-dialog-container-shape: 20px;
}
like image 53
Jofred Reinosa Avatar answered Apr 24 '26 02:04

Jofred Reinosa


Demo Did you try to add

.mat-dialog-container {
  border-radius: 20px !important;
}

inside global styles.css

or if you just want this dialog then give custom class with panelClass options as example below

this.dialog.open(dialogComponent, { panelClass: 'custom-container' });

and

.custom-container .mat-dialog-container {
   border-radius: 20px !important;
}

inside global styles.css

like image 30
mr. pc_coder Avatar answered Apr 24 '26 01:04

mr. pc_coder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!