Skip to content
Notifications in Shiny apps
Branch: master
Clone or download
Tutuchan and gaborcsardi Add toastr_clear_all function (#2)
* Add clear_toasts function

* Rename clear_toast to toastr_clear_all
Latest commit 4cf139c Aug 29, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R Add toastr_clear_all function (#2) Aug 29, 2016
inst Add toastr_clear_all function (#2) Aug 29, 2016
man Add toastr_clear_all function (#2) Aug 29, 2016
.Rbuildignore R ignore Travis and Appveyor config Jun 5, 2016
.travis.yml Travis and Appveyor config Jun 5, 2016
DESCRIPTION Quote DESCRIPTION [ci skip] Jun 5, 2016
LICENSE First working version Jun 5, 2016
NAMESPACE
NEWS.md Add NEWS.md file [ci skip] Jun 5, 2016
README.md Correct brackets. Jul 29, 2016
appveyor.yml Travis and Appveyor config Jun 5, 2016

README.md

shinytoastr

Notifications in Shiny, via toastr

Project Status: Active - The project has reached a stable, usable state and is being actively developed. Linux Build Status Windows Build status CRAN RStudio mirror downloads

Installation

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

Usage

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

License

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

You can’t perform that action at this time.