Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

shinyFeedback (version 0.1.0)

showSnackbar: showSnackbar

Description

Server side function to show a snackbar. This function should be called in the expression passed to shiny::observe() or shiny::observeEvent().

Usage

showSnackbar(id, autoHideDuration = 3000)

Arguments

id

A length 1 character vector. A unique id for the snackbar.

autoHideDuration

A length 1 numeric vector. The amount of time in milliseconds to show the snackbar (e.g. 3000 is 3 seconds). Set to NULL to keep snackbar open indefinitely.

Examples

Run this code
# NOT RUN {
## Only run examples in interacive R sessions
if (interactive()) {
  
  ui <- fluidPage(
    useShinyFeedback(),
    
    actionButton(
      "showSnackbarBtn",
      "Show Snackbar"
    ),
    
    snackbar(
      id = "mySnackbar",
      message = "Have a snack!"
    )
  )
  
  server <- function(input, output) {
    observeEvent(input$showSnackbarBtn, {
      showSnackbar("mySnackbar")
    })
  }
  
  shinyApp(ui, server)
}

# }

Run the code above in your browser using DataLab