useShinyalert {shinyalert}R Documentation

Set up a Shiny app to use shinyalert

Description

This function must be called from a Shiny app's UI in order for the shinyalert function to work.

You can call useShinyalert() from anywhere inside the UI.

Usage

useShinyalert()

Value

Scripts that shinyalert requires that are automatically inserted to the app's <head> tag.

See Also

shinyalert

Examples

if (interactive()) {
  library(shiny)
  library(shinyalert)

  shinyApp(
    ui = fluidPage(
      useShinyalert(),  # Set up shinyalert
      actionButton("btn", "Click me")
    ),
    server = function(input, output) {
      observeEvent(input$btn, {
        # Show a simple modal
        shinyalert(title = "You did it!", type = "success")
      })
    }
  )
}

[Package shinyalert version 1.0 Index]