notiflix-confirm: Confirm dialog with notiflix.js

Description Usage Arguments Note Examples

Description

Initialize with use_notiflix_confirm in UI before using nx_confirm server-side. Retrieve value server-side with input$<inputId>.

Usage

 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
nx_confirm(
  inputId,
  title,
  message = NULL,
  button_ok = "Ok",
  button_cancel = "Cancel",
  session = shiny::getDefaultReactiveDomain()
)

use_notiflix_confirm(
  backgroundColor = "#f8f8f8",
  borderRadius = "25px",
  backOverlay = TRUE,
  backOverlayColor = "rgba(0,0,0,0.5)",
  titleFontSize = "16px",
  titleColor = "#00b462",
  titleMaxLength = 34,
  messageFontSize = "13px",
  messageMaxLength = 400,
  buttonsFontSize = "14px",
  buttonsMaxLength = 34,
  okButtonColor = "#f8f8f8",
  okButtonBackground = "#00b462",
  cancelButtonColor = "#f8f8f8",
  cancelButtonBackground = "#a9a9a9",
  cssAnimation = TRUE,
  cssAnimationDuration = 360,
  cssAnimationStyle = c("fade", "zoom"),
  plainText = FALSE,
  width = "280px"
)

Arguments

inputId

The input slot that will be used to access the value.

title

Title of the dialog.

message

Message of the dialog.

button_ok

Label for OK button.

button_cancel

Label for cancel button.

session

Shiny session.

backgroundColor

Changes the background color.

borderRadius

Changes the radius of the corners.

backOverlay

If you don't want to use a colored overlay you can change this option to FALSE.

backOverlayColor

Changes the color of the overlay. You can use HEX, RGB or RGBA.

titleFontSize

Changes the font-size of the title text.

titleColor

Changes the color of the title text.

titleMaxLength

Ignores characters of title text after the specified number.

messageFontSize

Changes the font-size of the message text.

messageMaxLength

Ignores characters of message text after the specified number.

buttonsFontSize

Changes the font-size of the button text.

buttonsMaxLength

Ignores characters of button text after the specified number.

okButtonColor

Changes the color of the OK button text.

okButtonBackground

Changes the background color of the OK button.

cancelButtonColor

Changes the color of the CANCEL button text.

cancelButtonBackground

Changes the background color of the CANCEL button.

cssAnimation

Notiflix uses CSS animations to show/hide the Reports. If you don't want to use CSS animations you can set this option to FALSE.

cssAnimationDuration

Changes the CSS animations duration as milliseconds. Tip: 360 ms = 0.36 second.

cssAnimationStyle

2 types of styles you can use: "fade" and "zoom".

plainText

Use only plain text (no HTML tags). Default to FALSE.

width

Changes the width. You can use "px" or "%". Default to "280px".

Note

Configuration is done with use_notiflix_report in UI per application.

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
if (interactive()) {
  library(shiny)
  
  ui <- fluidPage(
    use_notiflix_confirm(),
    tags$h2("notiflix confirmation pop-up"),
    actionButton("show", "Ask for confirmation"),
    verbatimTextOutput("result")
  )
  
  server <- function(input, output, session) {
    
    observeEvent(input$show, {
      nx_confirm(
        inputId = "confirm",
        title = "Do you want to confirm?",
        message = tags$div(
          tags$b("This is very important !"),
          "You must click one button below !"
        ),
        button_ok = "Sure!",
        button_cancel = "Nope!"
      )
    })
    
    output$result <- renderPrint({
      input$confirm
    })
  }
  
  shinyApp(ui, server)
}

dreamRs/shinypop documentation built on Oct. 18, 2021, 8:28 p.m.