Additional confirmation before task to be performed by respective buttons

I have four buttons to do a certain task. But after every button click, I want confirmation from the user.
I came across help from plotly

ConfirmDialogProvider | Dash for Python Documentation | Plotly in plotly
Input two or more button - How to tell which button is pressed? - #26 by maral
suggested by chriddyp

But how can I place a callback that returns the button type clicked + process task on ok confirmation
any suggestions welcomed

Hi @yogi_dhiman ,

you could wrap each button in a dialog.

Adapting this example from the help:

to your question leads to :

import dash
from dash import Input, Output, html, dcc, callback_context

app = dash.Dash(__name__)

app.layout = html.Div(
                    children=html.Button(f'Button{i}', ),
                    message=f'Danger danger! You clicked button{i}'
                ) for i in range(5)

    Output('output-provider', 'children'),
        Input(f'danger-danger-provider-{i}', 'submit_n_clicks')
        for i in range(5)
def update_output(*submit_n_clicks):
    trigger = callback_context.triggered_id
    return f'output was triggerd by "{trigger}"'

if __name__ == '__main__':

Obviously you would have to launch a different process depending on the trigger in update_output

Are you suggesting that each button will have its own ConfirmDialogProvider?
I was assuming that the same ConfirmDialogProvider can be used for all the buttons.

The dcc.ConfirmDialogProvider can have multiple buttons as children (in a list), but based on the properties of the dcc.ConfirmDialogProvider, I think you canโ€™t extract the information concerning which of the children actually triggered the dialog.

If your intention is to start a different process depending on which button has been clicked, you need the information of the triggering button. Hence the need for wrapping each button in a separate dcc.ConfirmDialogProvider IMHO.

I got the wrapper function logic. Even if I do so!
I donโ€™t see the callback function that asks for confirmation from the user for the relative button clicked.

Also seems like the callback_context.triggered_id is depreciated. Somehow the dialog box is not poping with the example given.

The problem was at my side all my buttons were under dbc. group button and hence escaping the wrapper function logic. I think you can ignore my last query