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
Expose the Collapse widget #1926
Comments
As a workaround (and maybe good enough?), an accordion widget with one child is essentially this collapse widget. |
Hi, |
@jasongrout +1
@vishma import ipywidgets as widgets
slider = widgets.SelectionSlider(
options=['How', 'do', 'you', 'like', 'it?'],
value='How',
disabled=False,
continuous_update=False,
orientation='horizontal',
readout=True
)
left = widgets.Accordion([slider])
left.set_title(0, 'Left')
right = widgets.Accordion([slider])
right.set_title(0, 'Right')
top = widgets.Accordion([slider])
top.set_title(0, 'Top')
center = widgets.Accordion([slider])
center.set_title(0, 'Center')
bottom = widgets.Accordion([slider])
bottom.set_title(0, 'Bottom')
app = widgets.HBox([
left,
widgets.VBox([
top,
center,
bottom,
]),
right,
])
app # Collapse all
left.selected_index = None
right.selected_index = None
top.selected_index = None
center.selected_index = None
bottom.selected_index = None # Expand all
left.selected_index = 0
right.selected_index = 0
top.selected_index = 0
center.selected_index = 0
bottom.selected_index = 0 |
Forgive my ignorance, but is this issue for having (optionally) many widgets visible at the same time in an Accordion? |
Essentially, yes. |
Thank you. You may include this user-facing functionality in the title, if you wish (and keep the current title for the PR). |
@jasongrout would it be possible to change the allowed traits for selected_index for Accordion to a list/tuple? And just delegate this change to frontend. Should be backwards compatible and allow for multiple selection, am I wrong? |
The accordion widget is basically a vbox of Collapse widgets, with the added logic that only one collapse widget can be open at a time. We should also expose the single Collapse widget, so it's easy for people to have a single collapse widget, or multiple open, etc.
Basically, we need to expose the Collapse widget defined in https://github.com/jupyter-widgets/ipywidgets/blob/master/packages/controls/src/phosphor/accordion.ts, perhaps with a new widget, like a new box widget in https://github.com/jupyter-widgets/ipywidgets/blob/master/packages/controls/src/widget_box.ts.
The text was updated successfully, but these errors were encountered: