dccConfirmDialogProvider

Send an alert with dccConfirmDialog
when the user clicks the children of this component, usually a button.

library(dashCoreComponents)
library(dashHtmlComponents)
library(dash)

app <- Dash$new()

app$layout(htmlDiv(list(
  dccConfirmDialogProvider(
    children=htmlButton(
      'Click Me'
    ),
    id='danger-danger-provider',
    message='Danger danger! Are you sure you want to continue?'
  ),
  htmlDiv(id='output-provider')
)))

app$callback(
  output = list(id = 'output-provider', property = 'children'),
  params=list(input(id = 'danger-danger-provider', property = 'submit_n_clicks')),
  function(submit_n_clicks){
    if(is.null(submit_n_clicks) == TRUE){
      return('')
    } else{
      sprintf('It was dangerous but we did it!
              Submitted %g', submit_n_clicks)
    }
    }

)

ConfirmDialogProvider Properties

Our recommended IDE for writing Dash apps is Dash Enterprise’s
Data Science Workspaces,
which has typeahead support for Dash Component Properties.
Find out if your company is using
Dash Enterprise
.

children (logical | numeric | character | unnamed list | named list; optional):
The children to hijack clicks from and display the popup.

id (character; optional):
The ID of this component, used to identify dash components in
callbacks. The ID needs to be unique across all of the components in
an app.

message (character; optional):
Message to show in the popup.

submit_n_clicks (numeric; default 0):
Number of times the submit was clicked.

submit_n_clicks_timestamp (numeric; default -1):
Last time the submit button was clicked.

cancel_n_clicks (numeric; default 0):
Number of times the popup was canceled.

cancel_n_clicks_timestamp (numeric; default -1):
Last time the cancel button was clicked.

displayed (logical; optional):
Is the modal currently displayed.

loading_state (named list; optional):
Object that holds the loading state object coming from dash-renderer.

loading_state is a named list with keys:

  • component_name (character; optional):
    Holds the name of the component that is loading.

  • is_loading (logical; optional):
    Determines if the component is loading or not.

  • prop_name (character; optional):
    Holds which property is loading.