-
Notifications
You must be signed in to change notification settings - Fork 949
Width for dropdown list and description labels #2050
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I appreciate you've been trying to figure this out yourself. Feel free to post a question before struggling for days - often a quick pointer from us can save you a lot of time! For adusting the width of the dropdown, you can explicitly set the width, or you can set width to from ipywidgets import *
Dropdown(layout={'width': 'initial'}, options=['very very very very very very very very very very very very very very long option', 'another option']) For setting the width of the description label, you can set the from ipywidgets import *
RadioButtons(description='Some long description', style={'description_width': 'initial'}, options=['a', 'b', 'c']) (setting the description width is described in the docs at http://ipywidgets.readthedocs.io/en/latest/examples/Widget%20Styling.html#Description) |
Is there a way to decrease size of the options boxes? The boxes that I use is larger than what I need. widgets.Dropdown(
options=[('Y', 1), ('X', 2)],
value=1,
description='Type:', style=style) |
Try this: widgets.Dropdown(
options=[('Y', 1), ('X', 2)],
value=1,
description='Type:', layout={'width': 'max-content'}) See https://developer.mozilla.org/en-US/docs/Web/CSS/width#max-content |
@jasongrout thanks for the tip, this is what I was looking for. |
We've designed the widgets' widths so that they lay out nicely with each other for common cases (they all have approximately the same width), but made it possible to adjust that if necessary. |
@jasongrout I can appreciate that, although some may argue that they are far too narrow for everyday use (in my case, more than half of the radio selectors I use get crippled due to width issue, even though my strings are not that long). In any case, if the width is fixed, do you think it would be possible to add this
I had to find this GitHub issue via Google to enable this easy fix, so I'm somewhat certain that others would be struggling with this too. |
Absolutely! We definitely need better documentation. And we're open to redesigning how the widgets fit together, or re-examining the tradeoffs and compromises. It's just that a redesign should probably be done comprehensively so that things stay consistent with the overall design goals. |
Do you want to make a PR? |
I was expecting that you would say that, @jasongrout :) |
Is this closed by #2735 then? |
Yes, I think so. Thanks @adam-ah! |
From jasongrout/ipythonwidgets#2:
Hello,
I have been struggling for days on trying to find out a way to:
I would be very grateful to receive your help.
Warm regards,
Graziella
The text was updated successfully, but these errors were encountered: