dccConfirmDialog: ConfirmDialog component

Description Usage Arguments Value Examples

View source: R/dccConfirmDialog.R

Description

ConfirmDialog is used to display the browser's native "confirm" modal, with an optional message and two buttons ("OK" and "Cancel"). This ConfirmDialog can be used in conjunction with buttons when the user is performing an action that should require an extra step of verification.

Usage

1
2
3
dccConfirmDialog(id=NULL, message=NULL, submit_n_clicks=NULL,
submit_n_clicks_timestamp=NULL, cancel_n_clicks=NULL,
cancel_n_clicks_timestamp=NULL, displayed=NULL)

Arguments

id

Character. 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. Message to show in the popup.

submit_n_clicks

Numeric. Number of times the submit button was clicked

submit_n_clicks_timestamp

Numeric. Last time the submit button was clicked.

cancel_n_clicks

Numeric. Number of times the popup was canceled.

cancel_n_clicks_timestamp

Numeric. Last time the cancel button was clicked.

displayed

Logical. Set to true to send the ConfirmDialog.

Value

named list of JSON elements corresponding to React.js properties and their values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
if (interactive() && require(dash)) {
    library(dash)
    library(dashCoreComponents)
    library(dashHtmlComponents)

    app <- Dash$new()

    app$layout(
      htmlDiv(
        list(
          dccConfirmDialog(
            id='confirm',
            message='Danger danger! Are you sure you want to continue?'),
          dccDropdown(
            options=lapply(list('Safe', 'Danger!!'),function(x){list('label'= x, 'value'= x)}),
            id='dropdown'
          ),
          htmlDiv(id='output-confirm1')
        )
      )
    )

    app$callback(
      output = list(id = 'confirm', property = 'displayed'),
      params=list(input(id = 'dropdown', property = 'value')),
      function(value){
        if(value == 'Danger!!'){
          return(TRUE)}
        else{
          return(FALSE)}
      })

  app$run_server()
}

Example output



dashCoreComponents documentation built on July 1, 2020, 8:20 p.m.