How to Create collapsible sidebar

how to create a collapsible sidebar?

Not sure if you could get the “sliding” effect using pure Dash (you might have to use some JS or CSS), but you could use a dcc.Button to return the contents into a html.Div, e.g.

dash.layout=html.Div([
...
dcc.Button(id='show_hide'),
...
dcc.Div(id='contents-container')
])

@app.callback(Output('contents-container','children'),[Input('show_hide','n_clicks')])
def do_show_hide(n_clicks):
    if n_clicks % 2:
        ... generate the contents ...
        return contents
    else:
         return ''
1 Like