ContextMenu and MenuItem width

UI Components for Angular
Post Reply
bill.franklin
Posts: 8
Joined: 17 Feb 2017, 21:31

10 Mar 2017, 19:23

PrimeNG version 2.0.2

Putting this out there so that maybe it helps save someone else a couple hours of trial and error and searching.


on the contextMenu tag, use [style]="{'width':'12.5em'}"

I am showing the current default for the context menu. I had to bump mine up to 15em to get the menu items to fit nicely.

jackstuard
Posts: 28
Joined: 03 Aug 2011, 15:53

12 Nov 2018, 14:58

Thanks you! that help me!

JACrazy
Posts: 20
Joined: 19 Mar 2018, 17:48

31 May 2019, 17:35

I know this thread is old, but the proper way to remove word wrapping and have the width adjust to fit the content is:

Code: Select all

[style]="{'white-space':'nowrap', 'width': 'auto'}"
or from the css:

Code: Select all

.ui-contextmenu{
    white-space: nowrap;
    width: auto;
}
You can add "min-width: 12.5em" so that it doesnt shrink too much for smaller content

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 29 guests