Distinguish inputs on callback

An output can have only one callback. Consider the following callback that is supposed to switch the content of a div on the click of a button. I would like two buttons to control the area content. I know that the callback can have multiple inputs, but how can I distinguish which buttons have been clicked if I only have the n_clicks property?

    Output('div', 'children'),
        Input('button-1', 'n_clicks'),
        Input('button-2', 'n_clicks'),
def switch_area(button_1_clicks, button_2_clicks):

You can compare the last clicked time stamp property of the buttons.

Of course - wish I had thought of it.

It’s a bit of a hack though, isn’t it? Potential new feature for Dash to make this unnecessary?

Yep, it is a bit of a hack. There’s a discussion over here about a more general solution to the problem.