Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

What exactly the undo/redo buttons are for?


I’ve recently notice that in my dash app, a pair of undo/redo buttons show up when I select different tabs with different graphs each. But, I don’t know what exactly they “undo” or “redo” (undo a selection of graphs?, undo input parameters?) and in which scenarios they are useful.


@Abeserra - These buttons revert to the previous (or next) state. So, if you select “Option A” and then select “Option B”, clicking undo will reselect “Option A” (and call the appropriate callback). They are mostly useful for complex apps where people might want to go back in time through their selections (especially if they selected something unexpected).

Overtime, there might be a richer “Dash toolbar” that allows for more types of actions (saving, undo/redo, downloading), this is just the start.

You can always remove these buttons with css, see Is it possible to hide the floating toolbar?

Got it. Thank you @chriddyp!

For me the undo button does not change anything.
My function looks like this:

@app.callback(Output('Docs', 'children'),
              [Input('button', 'n_clicks')],
              [State('input', 'value')])
def clean_data(n_clicks, input):
     if n_clicks is not None and input is not None:
            return ...

So for example, I enter “Option A” in the input box and click the button, then enter “Option B” in the input box and click the button. Then clicking undo nothing is changed. I am hoping that the undo can go back to “Option A”. What can I do to to make it work?