Skip to content
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

Introduce a ToggleButtons button_width style attribute. #1257

Merged
merged 3 commits into from Jul 15, 2017

Conversation

@jasongrout
Copy link
Member

@jasongrout jasongrout commented Apr 5, 2017

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

@jasongrout jasongrout commented Apr 5, 2017

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

Loading

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

@maartenbreddels maartenbreddels commented Apr 18, 2017

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

Loading

@jasongrout
Copy link
Member Author

@jasongrout jasongrout commented Apr 19, 2017

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

Loading

@maartenbreddels
Copy link
Member

@maartenbreddels maartenbreddels commented Apr 20, 2017

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

Loading

@jasongrout
Copy link
Member Author

@jasongrout jasongrout commented Apr 20, 2017

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?

Loading

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

@jasongrout jasongrout commented Jun 30, 2017

Loading

@jasongrout
Copy link
Member Author

@jasongrout jasongrout commented Jul 9, 2017

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.

Loading

jasongrout added 2 commits Jul 15, 2017
…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

@jasongrout jasongrout commented Jul 15, 2017

I updated this for the current state of the codebase.

Loading

@jasongrout
Copy link
Member Author

@jasongrout jasongrout commented Jul 15, 2017

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.

Loading

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

@replork 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?

Loading

@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.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants