Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

update Dropdown to accept maxHeight prop #785

Closed
pfbuxton opened this issue Apr 3, 2020 · 7 comments · Fixed by plotly/dash#2109
Closed

update Dropdown to accept maxHeight prop #785

pfbuxton opened this issue Apr 3, 2020 · 7 comments · Fixed by plotly/dash#2109

Comments

@pfbuxton
Copy link

pfbuxton commented Apr 3, 2020

It would be very useful (especially with long lists) to be able to change the height of the Dropdown - the default settings allow for 5.7 options to be shown (optionHeight=35 and maxHeight=200).

A similar issue has been resolved (#552) to allow the optionHeight prop to be passed, i.e.

dcc.Dropdown(
    id = 'dropdown_id',
    options = my_options,
    optionHeight = 35,
    # maxHeight = 80
),

so allow maxHeight to be passed in the same way.

See https://github.com/bvaughn/react-virtualized-select/blob/master/README.md#react-virtualized-select-props

@marcsiebs
Copy link

This would be very helpful to me as well

@lacrendic
Copy link

It definitely would be very helpful. Is there any workaround? I don't want all selected items to be displayed, there are too many at times

@pfbuxton
Copy link
Author

@lacrendic I made this post a while ago when I didn't fully understand how dash worked. I now have a better understanding of how dash works and wanted to see if I could now fix this myself. Good news I made the dropdown longer:

Capture

Here is the repository where I made the changes:
https://github.com/pfbuxton/dash-core-components

The changes involved:

  1. Exposing the maxHeight prop
  2. Changing this css file:
    https://github.com/plotly/dash-core-components/blob/dev/src/components/css/react-select%401.0.0-rc.3.min.css

I don't understand how to change the css styling programmatically within Javascript (I simply don't have any more time to work on this at the moment). If anyone would like to pick this up and finish the job that would be nice.

To build and install a dash component you need to do this:

npm run build
python3 setup.py build
python3 setup.py install

@PedroCanoM
Copy link

@pfbuxton, how did you manage to do it? I'm also trying to change the default maxHeigth. In fact, I've tried to build a custom dcc dropdown that includes this property with no success. I tried to access to your repository, but it seems to have been deleted.
I appreciate any kind of help.

@PedroCanoM
Copy link

As it is described here: https://community.plotly.com/t/dash-custom-dropdown-component/51293?u=pkane , I've maintained the multi-folder structure and the same error happens. I've used the dash-component-boilerplate repository.

@marchinidavide
Copy link

Any update on this?

@alexcjohnson
Copy link
Collaborator

We'd gladly accept a PR if someone would like to add this prop. Please note that this repo is no longer in use, dash core components are now part of the main dash repo

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants