A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/gaborcsardi/shinytoastr below:

gaborcsardi/shinytoastr: Notifications in Shiny apps

Notifications in Shiny, via toastr

source("https://install-github.me/gaborcsardi/shinytoastr")

Call useToastr() at the beginning of ui definition, and then in the server definition use one of the notification functions, toastr_success(), toastr_info(), toastr_warning() or toastr_error() to create notifications:

library(shinytoastr)

ui <- shinyUI(fluidPage(
  useToastr(),
  pageWithSidebar(
    headerPanel("Header"),
    sidebarPanel(
	  ...
      actionButton(inputId = "save_button", label = "Save",
	                class = "btn-primary")
      ...
    ),
    mainPanel(
      ...
    )
  )
))
server <- function(input, output, session) {
  ...
  observeEvent(
    input$save_button,
    {
      tryCatch(
        {
          writeToDB(data)
          toastr_success("Saved to database")
        },
        error = function(e) {
          toastr_error(title = "Database error", conditionMessage(e))
        }
      )
    }
  )
}

MIT © John Papa, Tim Ferrell, Hans Fjällemark, Mango Solutions, Posit Software, PBC.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4