Title: | Alerts, Notifications and Loading Screen in 'Shiny' |
---|---|
Description: | 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. |
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) |
Maintainer: | Aravind Hebbali <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.2.0 |
Built: | 2024-10-29 06:55:48 UTC |
Source: | CRAN |
Preview different types of alerts/notifications.
Preview different types of spinners/loaders.
previewAlerts(type = "toast") previewSpinners(spinner = "threedots")
previewAlerts(type = "toast") previewSpinners(spinner = "threedots")
type |
Type of alert/notification. Valid values are:
|
spinner |
Type of spinner. The following spinners are available:
|
None
None
Pretty browser alerts and notifications.
useAlertify() alertify_alert( title = "Alert Title", message = "Alert Message", type = "success", btn_label = "OK", transition = "pulse", transition_off = FALSE, closable = TRUE, auto_reset = FALSE, frameless = FALSE, maximizable = FALSE, modal = FALSE, movable = FALSE, move_bounded = TRUE, overflow = FALSE, padding = TRUE, pinnable = FALSE, resizeable = FALSE, start_maximized = FALSE, session = getDefaultReactiveDomain() ) alertify_notify( message = "Alert Message", type = "success", delay = 5, position = "bottom-right", session = getDefaultReactiveDomain() )
useAlertify() alertify_alert( title = "Alert Title", message = "Alert Message", type = "success", btn_label = "OK", transition = "pulse", transition_off = FALSE, closable = TRUE, auto_reset = FALSE, frameless = FALSE, maximizable = FALSE, modal = FALSE, movable = FALSE, move_bounded = TRUE, overflow = FALSE, padding = TRUE, pinnable = FALSE, resizeable = FALSE, start_maximized = FALSE, session = getDefaultReactiveDomain() ) alertify_notify( message = "Alert Message", type = "success", delay = 5, position = "bottom-right", session = getDefaultReactiveDomain() )
title |
Dialog title. |
message |
Dialog contents. |
type |
Dialog type. Defaults to
|
btn_label |
The |
transition |
Transition effect to be used when showing/hiding the dialog. Defaults to
|
transition_off |
Logical; if |
closable |
Logical; if |
auto_reset |
Logical; if |
frameless |
Logical; if |
maximizable |
Logical; if |
modal |
Logical; if |
movable |
Logical; if |
move_bounded |
Logical; if |
overflow |
Logical; if |
padding |
Logical; if |
pinnable |
Logical; if |
resizeable |
Logical; if |
start_maximized |
Logical; if |
session |
Shiny session object. |
delay |
The time (in seconds) to wait before the notification is auto-dismissed. |
position |
Position of the notification. Defaults to
|
None
useAlertify
: Dependencies to include in your UI.
alertify_alert
: Display alerts.
alertify_notify
: Display notifications.
# Example 1: Alert if (interactive()) { library(shiny) library(standby) ui <- fluidPage( useAlertify(), # include dependencies actionButton(inputId = "btn", label = "Alert Demo") ) server <- function(input, output, session) { observeEvent(input$btn, { # display alert alertify_alert("Hey there!", "Thank you for exploring standby!") }) } shinyApp(ui, server) } # Example 2: Notification if (interactive()) { library(shiny) library(standby) ui <- fluidPage( useAlertify(), # include dependencies actionButton(inputId = "btn", label = "Notification Demo") ) server <- function(input, output, session) { observeEvent(input$btn, { # display notification alertify_notify("Hey there! Thank you for exploring standby!") }) } shinyApp(ui, server) }
# Example 1: Alert if (interactive()) { library(shiny) library(standby) ui <- fluidPage( useAlertify(), # include dependencies actionButton(inputId = "btn", label = "Alert Demo") ) server <- function(input, output, session) { observeEvent(input$btn, { # display alert alertify_alert("Hey there!", "Thank you for exploring standby!") }) } shinyApp(ui, server) } # Example 2: Notification if (interactive()) { library(shiny) library(standby) ui <- fluidPage( useAlertify(), # include dependencies actionButton(inputId = "btn", label = "Notification Demo") ) server <- function(input, output, session) { observeEvent(input$btn, { # display notification alertify_notify("Hey there! Thank you for exploring standby!") }) } shinyApp(ui, server) }
Bootstrap modals made easy.
useBootBox() bootBox( title = "Your title", message = "Your message here...", size = "small", close_on_escape = TRUE, show = TRUE, backdrop = NULL, close_button = TRUE, animate = TRUE, class = NULL, session = getDefaultReactiveDomain() )
useBootBox() bootBox( title = "Your title", message = "Your message here...", size = "small", close_on_escape = TRUE, show = TRUE, backdrop = NULL, close_button = TRUE, animate = TRUE, class = NULL, session = getDefaultReactiveDomain() )
title |
Adds a header to the dialog. |
message |
Text displayed in the dialog. |
size |
Adds the relevant Bootstrap modal size class to the dialog wrapper. Valid values are:
|
close_on_escape |
Logical; if |
show |
Logical; if |
backdrop |
Logical; if
|
close_button |
Logical; if |
animate |
Logical; if |
class |
Custom CSS class (using Animate.css). |
session |
Shiny session object. |
None
useBootBox
: Dependencies to include in your UI.
bootBox
: Display modals.
if (interactive()) { library(shiny) library(standby) ui <- fluidPage( useBootBox(), # include dependencies actionButton(inputId = "btn", label = "BootBox Demo") ) server <- function(input, output, session) { observeEvent(input$btn, { # display modal bootBox("Hey there!", "Thank you for exploring standby!") }) } shinyApp(ui, server) }
if (interactive()) { library(shiny) library(standby) ui <- fluidPage( useBootBox(), # include dependencies actionButton(inputId = "btn", label = "BootBox Demo") ) server <- function(input, output, session) { observeEvent(input$btn, { # display modal bootBox("Hey there!", "Thank you for exploring standby!") }) } shinyApp(ui, server) }
Simple CSS loaders
useLoaders() loaders(uiOutput, type = "default", style = NULL, text = NULL)
useLoaders() loaders(uiOutput, type = "default", style = NULL, text = NULL)
uiOutput |
An output element to be wrapped within a loader. |
type |
The type of loader to use. Visit https://css-loader.raphaelfabeni.com/ for details.
|
style |
Custom styling for the loaders. |
text |
Custom text. Available only for the following types:
|
None
useLoaders
: Dependencies to include in your UI.
loaders
: Display loading animation.
if (interactive()) { library(shiny) shinyApp( ui = fluidPage( useLoaders(), actionButton("render", "Render"), loaders(uiOutput = plotOutput("plot"), type = "default", style = "half", text = "Loading...") ), server = function(input, output) { output$plot <- renderPlot({ input$render Sys.sleep(3) hist(mtcars$mpg) }) } ) }
if (interactive()) { library(shiny) shinyApp( ui = fluidPage( useLoaders(), actionButton("render", "Render"), loaders(uiOutput = plotOutput("plot"), type = "default", style = "half", text = "Loading...") ), server = function(input, output) { output$plot <- renderPlot({ input$render Sys.sleep(3) hist(mtcars$mpg) }) } ) }
Minimal CSS only tooltip.
useMicroTip() microTip( id = NULL, tip = "Hey! tooltip!", position = "top", size = NULL, session = getDefaultReactiveDomain() )
useMicroTip() microTip( id = NULL, tip = "Hey! tooltip!", position = "top", size = NULL, session = getDefaultReactiveDomain() )
id |
The id of the element to attach the tooltip. |
tip |
Content of the tooltip. |
position |
Where the tooltip should appear relative to the target element. Defaults to
|
size |
Size of the tooltip. Defaults to
|
session |
Shiny session object. |
None
useMicroTip
: Dependencies to include in your UI.
microTip
: Add tooltip.
if (interactive()) { library(shiny) library(standby) ui <- fluidPage( useMicroTip(), # include dependencies br(), br(), br(), br(), actionButton(inputId = "btn", label = "MicroTip Demo") ) server <- function(input, output, session) { # display tooltip microTip(id = "btn", tip = "Hey there! This is a micro tip!", position = "bottom-right") } shinyApp(ui, server) }
if (interactive()) { library(shiny) library(standby) ui <- fluidPage( useMicroTip(), # include dependencies br(), br(), br(), br(), actionButton(inputId = "btn", label = "MicroTip Demo") ) server <- function(input, output, session) { # display tooltip microTip(id = "btn", tip = "Hey there! This is a micro tip!", position = "bottom-right") } shinyApp(ui, server) }
Beautiful notifications and prompts.
useNotify() notify( title = "Hey", text = NULL, type = "notice", icon = TRUE, delay = 8000, hide = TRUE, sticker = TRUE, closer = TRUE, shadow = TRUE, mouse_reset = TRUE, animation = "fade", animate_speed = "normal", width = "360px", min_height = "16px", max_text_height = "200px", translucent = FALSE, non_blocking = FALSE, session = getDefaultReactiveDomain() )
useNotify() notify( title = "Hey", text = NULL, type = "notice", icon = TRUE, delay = 8000, hide = TRUE, sticker = TRUE, closer = TRUE, shadow = TRUE, mouse_reset = TRUE, animation = "fade", animate_speed = "normal", width = "360px", min_height = "16px", max_text_height = "200px", translucent = FALSE, non_blocking = FALSE, session = getDefaultReactiveDomain() )
title |
Title of the notice. It can be a string, an element or |
text |
Text of the notice. It can be a string, an element or |
type |
Type of notice. Defaults to
|
icon |
Logical; if |
delay |
Delay in milliseconds before the notice is removed. If set to |
hide |
Logical; if |
sticker |
Logical; if |
closer |
Logical; if |
shadow |
Logical; if |
mouse_reset |
Logical; if |
animation |
The animation to be used while displaying and hiding the notice. |
animate_speed |
Speed at which the notice animates in and out. Valid values are:
|
width |
Width of the notice. Default is |
min_height |
Minimum height of the notice. Default is |
max_text_height |
Maximum height of the text container. Default is |
translucent |
Logical; if |
non_blocking |
Logical; if |
session |
Shiny session object. |
None
useNotify
: Dependencies to include in your UI.
notify
: Display notifications.
if (interactive()) { library(shiny) library(standby) ui <- fluidPage( useNotify(), # include dependencies actionButton(inputId = "btn", label = "PNotify Demo") ) server <- function(input, output, session) { observeEvent(input$btn, { # display notification notify("Hey there!", "Thank you for exploring standby!") }) } shinyApp(ui, server) }
if (interactive()) { library(shiny) library(standby) ui <- fluidPage( useNotify(), # include dependencies actionButton(inputId = "btn", label = "PNotify Demo") ) server <- function(input, output, session) { observeEvent(input$btn, { # display notification notify("Hey there!", "Thank you for exploring standby!") }) } shinyApp(ui, server) }
Simple website notifications with effects
useNS() notice( message = "Hello", type = "notice", layout = "growl", effect = "jelly", session = getDefaultReactiveDomain() )
useNS() notice( message = "Hello", type = "notice", layout = "growl", effect = "jelly", session = getDefaultReactiveDomain() )
message |
Notification message. |
type |
Notification type. Defaults to
|
layout |
Notification layout. Defaults to
|
effect |
Notification effect type. Valid values include:
|
session |
Shiny session object. |
None
useNS
: Dependencies to include in your UI.
notice
: Display notifications.
if (interactive()) { library(shiny) library(standby) ui <- fluidPage( useNS(), # include dependencies actionButton(inputId = "btn", label = "Notice Demo") ) server <- function(input, output, session) { observeEvent(input$btn, { # display notification notice("Hey there! Thank you for exploring standby!") }) } shinyApp(ui, server) }
if (interactive()) { library(shiny) library(standby) ui <- fluidPage( useNS(), # include dependencies actionButton(inputId = "btn", label = "Notice Demo") ) server <- function(input, output, session) { observeEvent(input$btn, { # display notification notice("Hey there! Thank you for exploring standby!") }) } shinyApp(ui, server) }
Simple CSS spinners.
useSpinkit() spinkit(uiOutput, type = "plane", color = "#333", size = "40px")
useSpinkit() spinkit(uiOutput, type = "plane", color = "#333", size = "40px")
uiOutput |
An output element to be wrapped within a spinner. |
type |
Type of spinner to use. Valid values are:
|
color |
Color of the spinner. Defaults to |
size |
Size of the spinner. Defaults to |
None
useSpinkit
: Dependencies to include in your UI.
spinkit
: Display loading animation.
if (interactive()) { library(shiny) shinyApp( ui = fluidPage( useSpinkit(), actionButton("render", "Render"), spinkit(plotOutput("plot"), type = "circle-fade") ), server = function(input, output) { output$plot <- renderPlot({ input$render Sys.sleep(3) hist(mtcars$mpg) }) } ) }
if (interactive()) { library(shiny) shinyApp( ui = fluidPage( useSpinkit(), actionButton("render", "Render"), spinkit(plotOutput("plot"), type = "circle-fade") ), server = function(input, output) { output$plot <- renderPlot({ input$render Sys.sleep(3) hist(mtcars$mpg) }) } ) }
A collection of loading spinners animated with CSS
useSpinners() spinners(uiOutput, type = 1, color = "#0275d8")
useSpinners() spinners(uiOutput, type = 1, color = "#0275d8")
uiOutput |
An output element to be wrapped within a spinner. |
type |
Type of spinner to use. Any integer between |
color |
Color of the spinner. Choose between hexadecimal or keyword values. |
None
useSpinners
: Dependencies to include in your UI.
spinners
: Display loading animation.
if (interactive()) { library(shiny) shinyApp( ui = fluidPage( useSpinners(), actionButton("render", "Render"), spinners(plotOutput("plot")) ), server = function(input, output) { output$plot <- renderPlot({ input$render Sys.sleep(3) hist(mtcars$mpg) }) } ) }
if (interactive()) { library(shiny) shinyApp( ui = fluidPage( useSpinners(), actionButton("render", "Render"), spinners(plotOutput("plot")) ), server = function(input, output) { output$plot <- renderPlot({ input$render Sys.sleep(3) hist(mtcars$mpg) }) } ) }
Single element CSS loading animation.
useThreeDots() threeDots(uiOutput, type = "elastic", color = "#9880ff")
useThreeDots() threeDots(uiOutput, type = "elastic", color = "#9880ff")
uiOutput |
An output element to be wrapped within a loader. |
type |
The type of animation to use. Visit https://nzbin.github.io/three-dots/ for details. |
color |
The color of the loader. Choose between hexadecimal, RGB or keyword values. |
None
useThreeDots
: Dependencies to include in your UI.
threeDots
: Display loading animation.
if (interactive()) { library(shiny) shinyApp( ui = fluidPage( useThreeDots(), actionButton("render", "Render"), threeDots(plotOutput("plot")) ), server = function(input, output) { output$plot <- renderPlot({ input$render Sys.sleep(3) hist(mtcars$mpg) }) } ) }
if (interactive()) { library(shiny) shinyApp( ui = fluidPage( useThreeDots(), actionButton("render", "Render"), threeDots(plotOutput("plot")) ), server = function(input, output) { output$plot <- renderPlot({ input$render Sys.sleep(3) hist(mtcars$mpg) }) } ) }
Minimalist and easy to use modals.
useTingle() tingle( content = "Hello", close_button = FALSE, button_label = "Close", button_type = "default", button_position = "right", session = getDefaultReactiveDomain() )
useTingle() tingle( content = "Hello", close_button = FALSE, button_label = "Close", button_type = "default", button_position = "right", session = getDefaultReactiveDomain() )
content |
Content of the modal. |
close_button |
Logical; if |
button_label |
Label of |
button_type |
Type of button. Defaults to
|
button_position |
Position of the button inside the modal. Defaults to
|
session |
Shiny session object. |
None
useTingle
: Dependencies to include in your UI.
tingle
: Display modals.
if (interactive()) { library(shiny) library(standby) ui <- fluidPage( useTingle(), # include dependencies actionButton(inputId = "btn", label = "Tingle Demo") ) server <- function(input, output, session) { observeEvent(input$btn, { # display modal tingle("Hey there!, Thank you for exploring standby!") }) } shinyApp(ui, server) }
if (interactive()) { library(shiny) library(standby) ui <- fluidPage( useTingle(), # include dependencies actionButton(inputId = "btn", label = "Tingle Demo") ) server <- function(input, output, session) { observeEvent(input$btn, { # display modal tingle("Hey there!, Thank you for exploring standby!") }) } shinyApp(ui, server) }
Lightweight toast notifications
useToast() toast( title = "Hey", message = NULL, type = NULL, theme = NULL, position = "center", duration = 5000, progress_bar_color = NULL, background_color = NULL, max_width = NULL, title_color = NULL, title_size = NULL, title_line_height = NULL, message_color = NULL, message_size = NULL, message_line_height = NULL, image = NULL, image_width = NULL, zindex = 99999, layout = 1, balloon = FALSE, close = TRUE, close_on_escape = FALSE, close_on_click = FALSE, rtl = FALSE, display_mode = 0, drag_to_close = TRUE, pause_on_hover = TRUE, reset_on_hover = FALSE, progress_bar_easing = "linear", overlay = FALSE, overlay_close = FALSE, overlay_color = "rgba(0, 0, 0, 0.6)", animate_inside = TRUE, transition_in = "fadeInUp", transition_out = "fadeOut", session = getDefaultReactiveDomain() )
useToast() toast( title = "Hey", message = NULL, type = NULL, theme = NULL, position = "center", duration = 5000, progress_bar_color = NULL, background_color = NULL, max_width = NULL, title_color = NULL, title_size = NULL, title_line_height = NULL, message_color = NULL, message_size = NULL, message_line_height = NULL, image = NULL, image_width = NULL, zindex = 99999, layout = 1, balloon = FALSE, close = TRUE, close_on_escape = FALSE, close_on_click = FALSE, rtl = FALSE, display_mode = 0, drag_to_close = TRUE, pause_on_hover = TRUE, reset_on_hover = FALSE, progress_bar_easing = "linear", overlay = FALSE, overlay_close = FALSE, overlay_color = "rgba(0, 0, 0, 0.6)", animate_inside = TRUE, transition_in = "fadeInUp", transition_out = "fadeOut", session = getDefaultReactiveDomain() )
title |
Title of the toast. |
message |
Message of toast. |
type |
Type of notification. Defaults to
|
theme |
Theme of toast. Choose between |
position |
Where toast will be shown. Defaults to
|
duration |
Time in milliseconds to close the toast. Defaults to |
progress_bar_color |
Progress bar color. Choose between hexadecimal, RGB or keyword values. |
background_color |
Background color of the toast. Choose between hexadecimal, RGB or keyword values. |
max_width |
Maximum width of the toast. |
title_color |
Title color. Choose between hexadecimal, RGB or keyword values. |
title_size |
Title font size. |
title_line_height |
Title line height. |
message_color |
Message color. Choose between hexadecimal, RGB or keyword values. |
message_size |
Message font size. |
message_line_height |
Message line height. |
image |
Cover image. |
image_width |
Width of cover image. Defaults to |
zindex |
The z-index CSS attribute of the toast. Defaults to |
layout |
Size of the toast. Choose between |
balloon |
Logical; if |
close |
Logical; if |
close_on_escape |
Logical; if |
close_on_click |
Logical; if |
rtl |
Logical; if |
display_mode |
Rules to show multiple toasts. Default is
|
drag_to_close |
Logical; if |
pause_on_hover |
Logical; if |
reset_on_hover |
Logical; if |
progress_bar_easing |
Animation easing of progress bar. Defaults to |
overlay |
Logical; if |
overlay_close |
Logical; if |
overlay_color |
Overlay background color. Defaults to |
animate_inside |
Logical; if |
transition_in |
Toast open animation. Defaults to
|
transition_out |
Toast close animation. Defaults to
|
session |
Shiny session object. |
None
useToast
: Dependencies to include in your UI.
toast
: Display toast notifications.
if (interactive()) { library(shiny) library(standby) ui <- fluidPage( useToast(), # include dependencies actionButton(inputId = "btn", label = "iziToast Demo") ) server <- function(input, output, session) { observeEvent(input$btn, { # display toast notification toast("Hey there!", "Thank you for exploring standby!") }) } shinyApp(ui, server) }
if (interactive()) { library(shiny) library(standby) ui <- fluidPage( useToast(), # include dependencies actionButton(inputId = "btn", label = "iziToast Demo") ) server <- function(input, output, session) { observeEvent(input$btn, { # display toast notification toast("Hey there!", "Thank you for exploring standby!") }) } shinyApp(ui, server) }
Loading bars and spinners.
useVizLoad() vizLoad( uiOutput, type = "bars", size = "large", color = NULL, add_label = FALSE, label = "Loading..." )
useVizLoad() vizLoad( uiOutput, type = "bars", size = "large", color = NULL, add_label = FALSE, label = "Loading..." )
uiOutput |
An output element to be wrapped within a spinner. |
type |
The type of bar/spinner to use. Valid values are:
|
size |
The size of the bar/spinner. Valid values are:
|
color |
The color of the bar/spinner. Choose between hexadecimal, RGB or keyword values. |
add_label |
Logical; if |
label |
The label to be displayed below the bar/spinner. |
None
useVizLoad
: Dependencies to include in your UI.
vizLoad
: Display loading animation.
if (interactive()) { library(shiny) shinyApp( ui = fluidPage( useVizLoad(), actionButton("render", "Render"), vizLoad(plotOutput("plot")) ), server = function(input, output) { output$plot <- renderPlot({ input$render Sys.sleep(3) hist(mtcars$mpg) }) } ) }
if (interactive()) { library(shiny) shinyApp( ui = fluidPage( useVizLoad(), actionButton("render", "Render"), vizLoad(plotOutput("plot")) ), server = function(input, output) { output$plot <- renderPlot({ input$render Sys.sleep(3) hist(mtcars$mpg) }) } ) }