primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Unitless Dialog Width-Height

Open geogauci opened this issue 9 years ago • 18 comments

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]

geogauci avatar Feb 03 '17 13:02 geogauci

+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?

gregorfelkar avatar Feb 15 '17 10:02 gregorfelkar

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

bakasmarius avatar Aug 09 '17 14:08 bakasmarius

Must have!

bickycheese avatar Aug 10 '17 13:08 bickycheese

Much needed feature.

blhussey avatar Aug 14 '17 12:08 blhussey

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

mlakhara avatar Aug 14 '17 15:08 mlakhara

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.

blhussey avatar Aug 14 '17 17:08 blhussey

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.

bakasmarius avatar Sep 11 '17 12:09 bakasmarius

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.

ericsvendsen avatar Sep 26 '17 04:09 ericsvendsen

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.

dhniels avatar Nov 11 '17 00:11 dhniels

+1

lasimone avatar Dec 19 '17 15:12 lasimone

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 avatar Jan 15 '18 13:01 ARandomDude

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

sourabh8003 avatar Jan 29 '18 14:01 sourabh8003

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

nanoTitan avatar Sep 19 '18 19:09 nanoTitan

also would need this, would be pretty nice

mahald avatar Sep 27 '18 16:09 mahald

+1

mahald avatar Sep 27 '18 16:09 mahald

+1

alesbrelih avatar Nov 08 '18 17:11 alesbrelih

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

cagataycivici avatar Dec 13 '18 10:12 cagataycivici

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

<p-dialog [style]="{width: '50vw'}"

cagataycivici avatar Dec 13 '18 11:12 cagataycivici