notie_confirm: Confirmation pop-up with notie.js

Description Usage Arguments Examples

View source: R/notie.R

Description

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

Usage

1
2
3
4
5
6
7
8
notie_confirm(
  inputId,
  text,
  label_submit = "Ok",
  label_cancel = "Cancel",
  position = c("top", "bottom"),
  session = shiny::getDefaultReactiveDomain()
)

Arguments

inputId

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

text

Text to display.

label_submit

Submit button label.

label_cancel

Cancel button label.

position

Where to display notification: "bottom" or "top".

session

Shiny session.

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
if (interactive()) {

  library(shiny)

  ui <- fluidPage(
    use_notie(),
    tags$h2("notie.js confirmation pop-up"),
    actionButton("show", "Ask for confirmation"),
    verbatimTextOutput("result")
  )

  server <- function(input, output, session) {

    observeEvent(input$show, {
      notie_confirm(
        inputId = "confirm",
        text = "Do you want to confirm?",
        label_submit = "Sure!",
        label_cancel = "Nope!"
      )
    })

    output$result <- renderPrint({
      input$confirm
    })
  }

  shinyApp(ui, server)

}

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