6

Ipywidget accordion is expanded by default when the notebook is executed for the first time. How to make the accordion collapsed by default ?

Thanks in Advance.

Vishma Dias
  • 630
  • 6
  • 11

1 Answers1

13

Set selected_index = None when creating the Accordion.

from ipywidgets import Accordion, FloatSlider
acc = Accordion(children=[FloatSlider()], selected_index=None)
display(acc)

enter image description here

ac24
  • 5,325
  • 1
  • 16
  • 31