Primeng: Unitless Dialog Width-Height

Created on 3 Feb 2017  路  18Comments  路  Source: primefaces/primeng

I'm submitting a ...

[x ] bug report => Search github for a similar issue or PR before submitting

Plunkr Case
http://plnkr.co/edit/JVIeFK

Current behavior
The dialog width is set to 300px, even if the width is set to auto. Also, not responsive.

Expected behavior
The dialog should by default take the width of the window, as per issue 1262. However, an auto width does not work at all.
My aim is to set the dialog width to 90% of the screen.

  • Angular version: 2.4.6
  • PrimeNG version: 2.0.0-rc3
  • Browser: [all]
enhancement

Most helpful comment

+1

I have similar issue, aiming to 80% window width. It would be very nice to have percent option on width attribute. Is there any workaround currently?

All 18 comments

+1

I have similar issue, aiming to 80% window width. It would be very nice to have percent option on width attribute. Is there any workaround currently?

This would really help to wait for the bug #2795 to be fixed.

Must have!

Much needed feature.

@blhussey @bakasmarius This was taken in v 4.1.1. Can you please update and verify ?

Angular: 4.3.4
PrimeNG: 4.1.3
Dynamic content is causing the issue. I forced the width on the content and the centering worked fine.

Angular: 4.4.0-RC.0
PrimeNG: 4.2.0-rc.1
I just tested it and setting width in html does nothing at all, no matter if it is in pixels or percents.
However, adding CSS to .ui-dialog { } and using width in it works for pixels and percents.

For now I used the ::ng-deep combinator to set a width on the dialog:

::ng-deep .ui-dialog {
    width: 90% !important;
}

Seems fine for now, but just remember that ng-deep will change eventually. Therefore it would be nice to have a built-in solution for this.

percentage support would be nice since the responsive property added at https://github.com/primefaces/primeng/issues/2795 doesnt work properly with dynamic content.

@ericsvendsen, your solution works great in the mean time. I added a max-width: 1000px to your rule to prevent it from getting absurdly wide on wider desktop screens.

+1

Please add this much-needed functionality. The workaround by @ericsvendsen does not seem to work for "dialogues in dialogues", meaning it does not work when a dialog has "appendTo='body'", and is probably not a lasting solution.

@ARandomDude: It'll work just keep that piece of css code at you top level component's scss/css file.

+1 on this. A percentage width is a must. The ng-deep solution could stop working in the future due to new version updates.

also would need this, would be pretty nice

+1

+1

We also need to support vw vh and any other units.

width, height, minWidth and minHeight are deprecated, suggested way is using the style prop with the unit you prefer;

<p-dialog [style]="{width: '50vw'}"
Was this page helpful?
0 / 5 - 0 ratings

Related issues

just-paja picture just-paja  路  3Comments

Faigjaz picture Faigjaz  路  3Comments

papiroca-tm picture papiroca-tm  路  3Comments

miresk picture miresk  路  3Comments

markgoho picture markgoho  路  3Comments