Dynamically set option width


Hi All

Is there any way of setting the width of the suggests programmatically?

By default it looks like the width is set to the same as the Select2 text area however the information we’re trying to show users is quite busy so we’d like to increase the width slightly to make it clearer to read.

Looking at what’s happening through the browser element inspector it looks like the width is set inline so I’m not sure how we can influence that.



Actually it looks like I can add to the select2-results class with CSS so that should do the job :slight_smile:


There is a “width” configuration property that is supposed to do what you want, but I find it’s not always accurate. I generally set the width myself using CSS (as you’re doing).