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

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

## 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) }