📣 Announcing! Dash Confirmation Modal - Feedback Welcome

Hello Dash Community –

We have created two new components: ConfirmDialog and ConfirmDialogProvider and and we’re looking for feedback from the community. We will be releasing this component on the stable branch this week, so now is the time to provide feedback!

These components can be tied together with buttons and links to provide “an extra step” for the user to go through before the callback is fired. Traditionally, these confirmation modals contain text like “Are you sure?”.

You can view the discussion and installation instructions here: https://github.com/plotly/dash-core-components/pull/211

7 Likes

Simple example:

import dash
from dash.dependencies import Input, Output
import dash_html_components as html
import dash_core_components as dcc

app = dash.Dash()

app.layout = html.Div([
    dcc.ConfirmDialogProvider(
        children=html.Button(
            'Click Me',
        ),
        id='danger-danger',
        message='Danger danger! Are you sure you want to continue?'
    ),
    html.Div(id='output')
])


@app.callback(Output('output', 'children'),
              [Input('danger-danger', 'submit_n_clicks')])
def update_output(submit_n_clicks):
    if not submit_n_clicks:
        return ''
    return """
        It was dangerous but we did it!
        Submitted {} times
    """.format(submit_n_clicks)

if __name__ == '__main__':
    app.run_server(debug=True)
4 Likes

How will it be performed on a group of buttons? I have created a topic on the same.