Confirm dialogue on Windows machine

Hi,
My business users using Windows machine and the confirm dialogue displays the page url on top of the dialogue. is there anyway we can have same style as what I see on the Mac machine without any page url displaying on top of the confirm dialogue?

Thanks,

Hello @231530353,

Not exactly sure what you mean by confirm dialogue?

Do you mean the browser default? If so, no. But you could utilize your own modal popup in order to achieve the same result and the styling would be the same.

I see.

This is what Iā€™m using: ConfirmDialog | Dash for Python Documentation | Plotly

so if one tries it on Mac vs Windows, the result in terms of cosmetic look is different.

Ah, yes, that is based upon the browser.

I would recommend a modal that performs the same actions.

I see, you mean this: Modal - dbc docs

1 Like

Here is an example that takes theirs:

from dash import Dash, Input, Output, html, dcc, callback, ctx
import dash_bootstrap_components as dbc

app = Dash(__name__,
           external_stylesheets=[dbc.themes.BOOTSTRAP])


app.layout = html.Div([
    dbc.Modal(
[
            dbc.ModalHeader('Danger danger!'),
            dbc.ModalBody('Are you sure you want to continue?'),
            dbc.ModalFooter([dbc.Button('Ok', id='confirm'),
            dbc.Button('Cancel', id='cancel'),])
        ],
        id='confirm-danger',

    ),

    dcc.Dropdown(['Safe', 'Danger!!'], id='dropdown-danger'),
    html.Div(id='output-danger')
])


@callback(Output('confirm-danger', 'is_open'),
              Input('dropdown-danger', 'value'),
            Input('cancel', 'n_clicks'),
            Input('confirm', 'n_clicks'),
          prevent_initial_call=True
          )
def display_confirm(value, n, n2):
    if ctx.triggered_id == 'cancel':
        return False
    if ctx.triggered_id == 'confirm':
        return False
    if value == 'Danger!!':
        return True
    return False


@callback(Output('output-danger', 'children'),
              Input('confirm', 'n_clicks'))
def update_output(submit_n_clicks):
    if submit_n_clicks:
        return 'It wasnt easy but we did it {}'.format(submit_n_clicks)


if __name__ == '__main__':
    app.run(debug=True)

image

amazing, thank you so much

1 Like