Skip to content

Introduce a ToggleButtons button_width style attribute. #1257

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

Merged
merged 3 commits into from
Jul 15, 2017

Conversation

jasongrout
Copy link
Member

Fixes #1189

screen shot 2017-04-05 at 3 10 41 pm

However, after doing this, I'm thinking we should do it a different way. For one, the assumption at https://github.com/jupyter-widgets/ipywidgets/blob/master/jupyter-js-widgets/src/widget.ts#L818 is now not true - the size of the widget could change. Two, perhaps a more useful default is to size the buttons with the content with some margin, with a minimum width so things don't get too small. Or use flex to layout the buttons in the space of the widget, so it's easy to control the total size of the buttons by changing the size of the buttons container.

@jasongrout
Copy link
Member Author

One question: is it more likely for people to want equal-sized buttons, or buttons sized to content?

@jasongrout jasongrout added this to the 7.0 milestone Apr 5, 2017
@maartenbreddels
Copy link
Member

Sometimes you want an ugly-but-using-all-the-availiable-space solution :)

@jasongrout
Copy link
Member Author

which would be equivalent to setting the button's width to flex: 1 (i.e., flex grow to fill space), right?

@maartenbreddels
Copy link
Member

I ment as small as possible, to use all the available space for widgets, would that also be possible?

@jasongrout
Copy link
Member Author

Okay, that was my question. Should we just change the default to 'size to content', but still provide an option to set a fixed size?

@jasongrout jasongrout force-pushed the master branch 6 times, most recently from 0a7fab4 to c0fc921 Compare May 19, 2017 17:48
@jasongrout
Copy link
Member Author

ping @SylvainCorlay

@jasongrout
Copy link
Member Author

which would be equivalent to setting the button's width to flex: 1 (i.e., flex grow to fill space), right?

Not sure what I was thinking there - we can't set the flex property in a width css attribute.

I'll punt this one to the beta.

…ation.

This is needed if, for example, the DOM structure is regenerated, and we want to set back the styles.
@jasongrout
Copy link
Member Author

I updated this for the current state of the codebase.

@jasongrout
Copy link
Member Author

Let's try this out. The default is the same fixed width as before. Setting the style.button_width to 'initial' makes each button size to its content.

@jasongrout jasongrout merged commit 6b68292 into jupyter-widgets:master Jul 15, 2017
@jasongrout jasongrout mentioned this pull request Jul 15, 2017
@replork
Copy link

replork commented Oct 14, 2020

My toggle button does not have a style.button_width property to set. Has this changed? How can I set the width of my toggle buttons?

@github-actions github-actions bot added the resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Feb 7, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
discussion resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scale size of the ToggleButtons to the text they contain
3 participants