Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apply styles in a PrimeNG dialog

I'm having troubles trying to apply styles in a PrimeNG dialog.

I have a component which have a PrimeNG dialog:

<p-dialog header="Filters" [(visible)]="display" width="1000" height="1000" modal="modal">
...
</p-dialog>

I also have a scss file where I have the styles of the component. The background-color of the dialog is transparent but I want to set it to white. So I've tried to apply the style in different ways in my scss file:

.ui-dialog {
    background-color: #fff;
}

Adding styleClass to the dialog and trying to apply styles to it:

<p-dialog styleClass="dialog-filters" header="Filters" [(visible)]="display" width="1000" height="1000" modal="modal">

.dialog-filters {
    background-color: #fff;
}

None of them works. Any idea?

like image 218
igogra Avatar asked Oct 23 '25 01:10

igogra


2 Answers

For a style argument you should use use []. So when you want to apply inline-style to p-dialog that would be for example <p-dialog [style]="{'margin-left':'80px', 'margin-right':'80px'}"></p-dialog>.

I must admit I very confused myself when primeng requires [], nothing or [()], at least when looking at their website, which is not frequently updated. So you better just take a look into their source code on github.

like image 191
Phil Avatar answered Oct 24 '25 16:10

Phil


use the following css method

:host ::ng-deep .ui-dialog .ui-dialog-titlebar{
    background: tomato; 
}
like image 35
kishor havaldar Avatar answered Oct 24 '25 15:10

kishor havaldar



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!