receiveSweetAlert: Display a Sweet Alert

Description Usage Arguments Note Examples

View source: R/sweetalert.R

Description

Send a message from the server and launch a sweet alert in the UI.

Usage

1
2
3
4
receiveSweetAlert(messageId)

sendSweetAlert(messageId, title = "Title", text = "Text", type = NULL,
  html = FALSE)

Arguments

messageId

The sweet alert id.

title

Title of the alert

text

Text of the alert

type

Type of the alert : null, info, success, warning or error

html

Logical. Use HTML in the text

Note

Use receiveSweetAlert() in the UI and sendSweetAlert() in the server.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
if (interactive()) {
 shinyApp(
  ui = fluidPage(
    tags$h1("Click the button"),
    actionButton(inputId = "success", label = "Launch a success sweet alert"),
    receiveSweetAlert(messageId = "successSw")
  ),
  server = function(input, output) {
    observeEvent(input$success, {
      sendSweetAlert(
        messageId = "successSw", title = "Success !!", text = "All in order", type = "success"
      )
    })
  }
 )
}

## End(Not run)

aghozlane/shinyWidgets documentation built on May 5, 2019, 8:01 p.m.