dcc.Dropdown options height auto adjust

Hello there,

I’m aware that it is possible to configure dcc.Dropdown options height, such as in the code above, which sets the options height to 100 pixels:

dcc.Dropdown(id='company', 
             placeholder = 'Select company',
             options=[{'label':k, 'value':k} for k in companies_list],
             optionHeight=100)

However, in a list of option labels with several different character lengths, it would be great to have the option height set based on the length of each option itself. In other words, I would like to do the following:

dcc.Dropdown(id='company', 
             placeholder = 'Select company',
             options=[{'label':k, 'value':k} for k in companies_list],
             optionHeight='auto')

Is it possible? If so, how to do it?

1 Like

I am also hunting for an answer to this question and would very much like to see this list. We are dynamically generating dropdowns out of dynamically generated content and an auto feature here would be enormously helpful.

2 Likes

Did you ever find a solution to this?

Not yet. I’m not sure how complex would be to integrate this setting to dropdowns, but I was hoping this could be available in a future dash release.

1 Like