Alerts, Notifications and Loading Screen in 'Shiny'

Easily create alerts, notifications, modals, info tips and loading screens in 'Shiny'. Includes several options to customize alerts and notifications by including text, icons, images and buttons. When wrapped around a 'Shiny' output, loading screen is automatically displayed while the output is being recalculated.


standby

CRAN_Status_Badge cranchecks R-CMD-check Codecov testcoverage status Lifecycle:stable

Easily create alerts, notifications, tooltips and loading screens in Shiny

Installation

# Install release version from CRAN
install.packages("standby")

# Install development version from GitHub
# install.packages("devtools")
devtools::install_github("rsquaredacademy/standby")

Usage

Loading Screens

To use spinners/loaders from standby in your Shiny application, include the following in the UI part of the app:

  • Include the dependencies using the appropriate use* functions (useSpinkit() in the below example).
  • Wrap the target output using corresponding rendering function (spinkit() in the below example).
Example
library(shiny)
library(standby)

ui <- fluidPage(

  standby::useSpinkit(), # include dependencies
  fluidRow(
    standby::spinkit(plotOutput("plot1")), # wrap output inside loader
    actionButton("render", "Render")
  )

)

server <- function(input, output, session) {

    output$plot1 <- renderPlot({
      input$render
      Sys.sleep(3)
      hist(mtcars$mpg)
    })

}

shinyApp(ui, server)

Details

The below table displays the dependency and rendering functions along with references:

Index Dependency Render Reference
1 useThreeDots() threeDots() Three Dots
2 useSpinkit() spinkit() SpinKit
3 useVizLoad() vizLoad() Loading Visualization
4 useSpinners() spinners() Spinners
5 useLoaders() loaders() Loaders

Alerts and Notifications

To use alerts or notifications from buzz in your Shiny application, follow the below steps:

  • Include the dependencies in the UI part of the app using the appropriate use* functions (useToast() in the below example).
  • Include the corresponding rendering function in the Server part of the app (toast() in the below example).
Example
library(shiny)
library(standby)
ui <- fluidPage(
  useBootBox(), # include dependencies
  actionButton(inputId = "notify",
               label   = "Show Notification")
)
server <- function(input, output, session) {
  observeEvent(input$pnotify, {
    bootBox(class = "rubberBand") # display the alert
  })
}
shinyApp(ui, server)

Details

The below table displays the dependency and rendering functions along with references:

Index Dependency Render Reference
1 useAlertify() alertify_alert() Alertify
2 useAlertify() alertify_notify() Alertify
3 useBootBox() bootBox() BootBox
4 useMicroTip() microTip() MicroTip
5 useNS() notice() Notification Styles
6 useNotify() notify() PNotify
7 useTingle() tingle() Tingle
8 useToast() toast() iziToast

Getting Help

If you encounter a bug, please file a minimal reproducible example using reprex on github. For questions and clarifications, use StackOverflow.

Code of Conduct

Please note that the standby project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("standby")

0.2.0 by Aravind Hebbali, 2 years ago


https://standby.rsquaredacademy.com/, https://github.com/rsquaredacademy/standby


Report a bug at https://github.com/rsquaredacademy/standby/issues


Browse source code at https://github.com/cran/standby


Authors: Aravind Hebbali [aut, cre] , Zong Bin [ctb, cph] (Author of Three Dots) , Tobias Ahlin [ctb, cph] (Author of SpinKit) , https://github.com/RIDICS [ctb, cph] (CSS loader code) , Raphael Fabini [ctb, cph] (Author of included CSS loader code) , Luke Hass [ctb, cph] (Author of included CSS loader code) , Mohammad Younes [ctb, cph] (Author of Alertify) , Nick Payne [ctb, cph] (Author of BootBox) , Indrashish Ghosh [ctb, cph] (Author of MicroTip) , https://github.com/codrops [ctb, cph] (Author of Notification Styles) , Hunter Perrin [ctb, cph] (Author of PNotify) , Robin Parisi [ctb, cph] (Author of Tingle) , Marcelo Dolza [ctb, cph] (Author of iziToast)


Documentation:   PDF Manual  


GPL (>= 3) license


Imports grDevices, htmltools, shiny

Suggests rmarkdown, kableExtra, knitr, testthat, covr


Suggested by xplorerr.


See at CRAN