| Title: | Loading Screen for 'Shiny' |
|---|---|
| Description: | Full screen and partial loading screens for 'Shiny' with spinners, progress bars, and notifications. |
| Authors: | John Coene [aut, cre], Jinhwan Kim [ctb], Victor Granda [ctb] (ORCID: <https://orcid.org/0000-0002-0469-1991>) |
| Maintainer: | John Coene <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.5.9000 |
| Built: | 2026-05-20 06:14:53 UTC |
| Source: | https://github.com/johncoene/waiter |
Manage the attendant loading bar with bootstrap 4.
maxMaximum value of the bar.
new()
Attendant$new( id, min = NULL, max = NULL, session = shiny::getDefaultReactiveDomain(), hide_on_max = FALSE )
idId of progress bar set with attendantBar.
min, maxMinimum and maximum value of the progress bar.
sessionA valid shiny session.
hide_on_maxWhether to hide the progress bar when it reaches its maximum value (defined in attendantBar). The progress bar automatically becomes visible again when it is set to a value below the maximum.
Initialise a progress bar
inc()
Attendant$inc(value = 1, text = NULL)
valueValue to increase the progress bar.
textText to display on the progress bar.
Increase
dec()
Attendant$dec(value = 1, text = NULL)
valueValue to decrease the progress bar.
textText to display on the progress bar.
Decrease
set()
Attendant$set(value, text = NULL)
valueValue to set the progress bar.
textText to display on the progress bar.
Set
done()
Attendant$done(text = NULL)
textText to display on the progress bar.
Done with progress
close()
Attendant$close(text = NULL)
textText to display on the progress bar.
Done with progress
auto()
Attendant$auto(ms = 400, value = 1)
msMilliseconds between increment of value.
valueValue to increment by at every ms.
Automatically increase the progress bar until done
getMin()
Attendant$getMin()
Get minimum value
getMax()
Attendant$getMax()
Get maximum value
getValue()
Attendant$getValue()
Get current value
clone()
The objects of this class are cloneable with this method.
Attendant$clone(deep = FALSE)
deepWhether to make a deep clone.
Create a Bootstrap 4 progress bar.
attendantBar( id, value = 0, min = 0, max = 100, text = NULL, color = c("primary", "info", "success", "danger", "warning"), striped = FALSE, animated = FALSE, height = 20, width = "100%", class = "", style = "", bg_color = "#f5f5f5", hidden = FALSE )attendantBar( id, value = 0, min = 0, max = 100, text = NULL, color = c("primary", "info", "success", "danger", "warning"), striped = FALSE, animated = FALSE, height = 20, width = "100%", class = "", style = "", bg_color = "#f5f5f5", hidden = FALSE )
id |
A unique identifier for the progress bar.
Used in |
value, min, max
|
Initial value, minimum, and maximum values the progress bar can take. |
text |
Optional text to display on the progress bar.
This can then be dynamically modified with |
striped |
Whether the progress bar should be striped. |
animated |
Whether to animate the stripe on the progress bar. |
height |
Height of the progress bar, numerical values
are converted to pixels ( |
width |
Width of the bar, defaults to |
class, style
|
Additional style and class to pass to the parent wrapper of the progress bar. |
bg_color, color
|
Color, and background color of the progress bar. |
|
Set to |
This function allows easily adding
waiters to dynamically rendered Shiny content where
"dynamic" means render* and *output function pair.
autoWaiter(id = NULL, html = NULL, color = NULL, image = "", fadeout = FALSE)autoWaiter(id = NULL, html = NULL, color = NULL, image = "", fadeout = FALSE)
id |
Vector of ids of elements to overlay the waiter.
If |
html |
HTML content of waiter, generally a spinner, see |
color |
Background color of loading screen. |
image |
Path to background image. |
fadeout |
Use a fade out effect when the screen is removed. Can be a boolean, or a numeric indicating the number of milliseconds the effect should take. |
This will display the waiter when the element is being recalculated and hide it when it receives new data.
library(shiny) library(waiter) ui <- fluidPage( autoWaiter(), actionButton( "trigger", "Render" ), plotOutput("plot"), plotOutput("dom") ) server <- function(input, output){ output$plot <- renderPlot({ input$trigger Sys.sleep(3) plot(cars) }) output$dom <- renderPlot({ input$trigger Sys.sleep(5) plot(runif(100)) }) } if(interactive()) shinyApp(ui, server)library(shiny) library(waiter) ui <- fluidPage( autoWaiter(), actionButton( "trigger", "Render" ), plotOutput("plot"), plotOutput("dom") ) server <- function(input, output){ output$plot <- renderPlot({ input$trigger Sys.sleep(3) plot(cars) }) output$dom <- renderPlot({ input$trigger Sys.sleep(5) plot(runif(100)) }) } if(interactive()) shinyApp(ui, server)
Create a garcon to animate images on the waiter.
useGarcon() use_garcon()useGarcon() use_garcon()
new()
Garcon$new(
image,
bg_color = "#FFFFFF",
opacity = 0.5,
direction = c("bt", "tb", "lr", "rl"),
filter = NULL
)imageThe CSS id of the image tag.
bg_colorBackground overlay color in hexadecimal or RGB.
opacityOverlay transparency.
directionAnimation direction. Possible values: lr (left to right),
rl (right to left), bt (bottom to top), tb (top to bottom).
filterFilter to apply, options are blur, grayscale, sepia,
hue-rotate, invert, opacity.
Initialise the garçon.
\dontrun{Garcon$new("img")$set(30)}
set()
Garcon$set(value)
valuePercentage to set to.
Value to set the garçon to.
\dontrun{Garcon$new("img")$set(30)}
inc()
Garcon$inc(value)
valuePercentage to increase to.
Value to increase the garçon to.
\dontrun{Garcon$new("img")$inc(30)}
reset()
Garcon$reset(value)
valuePercentage to set to.
Reset the garçon to.
\dontrun{Garcon$new("img")$set(30)$reset()}
destroy()
Garcon$destroy()
Kill the garçon to.
\dontrun{Garcon$new("img")$set(30)$destroy()}
print()
Garcon$print()
print the garcon
close()
Garcon$close()
Close the garçon.
\dontrun{Garcon$new("img")$set(30)$close()}
clone()
The objects of this class are cloneable with this method.
Garcon$clone(deep = FALSE)
deepWhether to make a deep clone.
## ------------------------------------------------ ## Method `Garcon$new` ## ------------------------------------------------ ## Not run: Garcon$new("img")$set(30) ## ------------------------------------------------ ## Method `Garcon$set` ## ------------------------------------------------ ## Not run: Garcon$new("img")$set(30) ## ------------------------------------------------ ## Method `Garcon$inc` ## ------------------------------------------------ ## Not run: Garcon$new("img")$inc(30) ## ------------------------------------------------ ## Method `Garcon$reset` ## ------------------------------------------------ ## Not run: Garcon$new("img")$set(30)$reset() ## ------------------------------------------------ ## Method `Garcon$destroy` ## ------------------------------------------------ ## Not run: Garcon$new("img")$set(30)$destroy() ## ------------------------------------------------ ## Method `Garcon$close` ## ------------------------------------------------ ## Not run: Garcon$new("img")$set(30)$close()## ------------------------------------------------ ## Method `Garcon$new` ## ------------------------------------------------ ## Not run: Garcon$new("img")$set(30) ## ------------------------------------------------ ## Method `Garcon$set` ## ------------------------------------------------ ## Not run: Garcon$new("img")$set(30) ## ------------------------------------------------ ## Method `Garcon$inc` ## ------------------------------------------------ ## Not run: Garcon$new("img")$inc(30) ## ------------------------------------------------ ## Method `Garcon$reset` ## ------------------------------------------------ ## Not run: Garcon$new("img")$set(30)$reset() ## ------------------------------------------------ ## Method `Garcon$destroy` ## ------------------------------------------------ ## Not run: Garcon$new("img")$set(30)$destroy() ## ------------------------------------------------ ## Method `Garcon$close` ## ------------------------------------------------ ## Not run: Garcon$new("img")$set(30)$close()
Add hostess dependencies.
use_hostess() useHostess()use_hostess() useHostess()
new()
Hostess$new(id = NULL, min = 0, max = 100, n = 1, infinite = FALSE)
idId used in hostess_loader if you generate the loader with
the loader method you may leave this NULL.
min, maxMinimum and maximum representing the starting and ending points of the progress bar.
nNumber of loaders to generate.
infiniteSet to TRUE to create a never ending loading bar, ideal
when you cannot compute increments or assess the time it might take before the
loading bar should be removed.
Create a hostess.
\dontrun{Hostess$new()}
start()
Hostess$start()
Start the hostess
print()
Hostess$print()
Print the hostess
set()
Hostess$set(value)
valueValue to set, between 0 and 100.
Set the hostess loading bar.
\dontrun{Hostess$new()$set(20)}
inc()
Hostess$inc(value)
valueValue to set, between 0 and 100.
Increase the hostess loading bar.
\dontrun{Hostess$new()$inc(10)}
close()
Hostess$close()
Close the hostess
\dontrun{Waitress$new("#plot")$close()}
get_loader()
Hostess$get_loader(
preset = NULL,
text_color = "#FFFFFF",
center_page = FALSE,
class = "",
min = NULL,
max = NULL,
svg = NULL,
progress_type = c("stroke", "fill"),
fill_direction = c("btt", "ttb", "ltr", "rtl"),
stroke_direction = c("normal", "reverse"),
fill_color = NULL,
stroke_color = NULL,
...
)presetA loading bar preset, see section below.
text_colorThe color of the loading text.
center_pageBy default the hostess is centered in the middle
of the screen, ideal when using it with waiter full screen, set to
FALSE to prevent that.
classCSS class.
min, maxMinimum and maximum representing the starting and ending points of the progress bar.
svgEither an svg path e.g.: M10 10L90 10 or the path to a .svg
file. Note that if passing the latter it must be made available to Shiny by
placing it either in the www folder or using shiny::addResourcePath().
progress_typeThe progress type, either stroke or fill.
Ther former traces the path of the svg while the latter fills it progressively.
fill_direction, stroke_directionThe direction which the progress bar should
take. Wether fill_direction or stroke_direction is used depends on
progress_type.
fill_color, stroke_colorThe color to use for the progress bar.
Wether fill_color or stroke_color is used depends on
progress_type.
...Any other other advanced options to pass to the loaded see the official documentation.
Create a hostess loading bar.
\dontrun{Hostess$new()$get_loader()}
set_loader()
Hostess$set_loader(loader)
loaderLoader as defined by hostess_loader().
Set a hostess loader as defined by hostess_loader().
\dontrun{
loader <- hostess_loader()
Hostess$new()$set_loader(loader)
}
notify()
Hostess$notify(
html = NULL,
background_color = "transparent",
text_color = "black",
position = c("br", "tr", "bl", "tl")
)htmlAdditional HTML content of the tag or a character string.
background_colorBackground color of the notification.
text_colorColor of text of html.
positionPosition of the notification on the screen.
Where br is the bottom-right, tr is the top-right,
bl is bottom-left, and tl is the top-left.
Use the hostess as a notification. It is hidden when set tpo 100.
\dontrun{Hostess$new()$notify()}
clone()
The objects of this class are cloneable with this method.
Hostess$clone(deep = FALSE)
deepWhether to make a deep clone.
## ------------------------------------------------ ## Method `Hostess$new` ## ------------------------------------------------ ## Not run: Hostess$new() ## ------------------------------------------------ ## Method `Hostess$set` ## ------------------------------------------------ ## Not run: Hostess$new()$set(20) ## ------------------------------------------------ ## Method `Hostess$inc` ## ------------------------------------------------ ## Not run: Hostess$new()$inc(10) ## ------------------------------------------------ ## Method `Hostess$close` ## ------------------------------------------------ ## Not run: Waitress$new("#plot")$close() ## ------------------------------------------------ ## Method `Hostess$get_loader` ## ------------------------------------------------ ## Not run: Hostess$new()$get_loader() ## ------------------------------------------------ ## Method `Hostess$set_loader` ## ------------------------------------------------ ## Not run: loader <- hostess_loader() Hostess$new()$set_loader(loader) ## End(Not run) ## ------------------------------------------------ ## Method `Hostess$notify` ## ------------------------------------------------ ## Not run: Hostess$new()$notify()## ------------------------------------------------ ## Method `Hostess$new` ## ------------------------------------------------ ## Not run: Hostess$new() ## ------------------------------------------------ ## Method `Hostess$set` ## ------------------------------------------------ ## Not run: Hostess$new()$set(20) ## ------------------------------------------------ ## Method `Hostess$inc` ## ------------------------------------------------ ## Not run: Hostess$new()$inc(10) ## ------------------------------------------------ ## Method `Hostess$close` ## ------------------------------------------------ ## Not run: Waitress$new("#plot")$close() ## ------------------------------------------------ ## Method `Hostess$get_loader` ## ------------------------------------------------ ## Not run: Hostess$new()$get_loader() ## ------------------------------------------------ ## Method `Hostess$set_loader` ## ------------------------------------------------ ## Not run: loader <- hostess_loader() Hostess$new()$set_loader(loader) ## End(Not run) ## ------------------------------------------------ ## Method `Hostess$notify` ## ------------------------------------------------ ## Not run: Hostess$new()$notify()
Customise the Hostess laoding bar.
hostess_loader( id = "hostess", preset = NULL, text_color = "#FFFFFF", center_page = FALSE, class = "", min = 0, max = 100, svg = NULL, progress_type = c("stroke", "fill"), fill_direction = c("btt", "ttb", "ltr", "rtl"), stroke_direction = c("normal", "reverse"), fill_color = NULL, stroke_color = NULL, ... ) hostess_gradient(angle = 0, duration = 1, colors = c("red", "white", "blue")) hostess_bubble( color_background = "#697682", color_bubble = "#f7fff7", count = 25, duration = 1 ) hostess_stripe(color1 = "#697682", color2 = "#f7fff7", duration = 1)hostess_loader( id = "hostess", preset = NULL, text_color = "#FFFFFF", center_page = FALSE, class = "", min = 0, max = 100, svg = NULL, progress_type = c("stroke", "fill"), fill_direction = c("btt", "ttb", "ltr", "rtl"), stroke_direction = c("normal", "reverse"), fill_color = NULL, stroke_color = NULL, ... ) hostess_gradient(angle = 0, duration = 1, colors = c("red", "white", "blue")) hostess_bubble( color_background = "#697682", color_bubble = "#f7fff7", count = 25, duration = 1 ) hostess_stripe(color1 = "#697682", color2 = "#f7fff7", duration = 1)
id |
Id of hostess (valid CSS). |
preset |
A loading bar preset, see section below. |
text_color |
The color of the loading text. |
center_page |
By default the hostess is not centered in the middle
of the screen, centering in the middle of the page is however ideal when using
it with waiter full screen, for the latter set to |
class |
CSS class. |
min, max
|
Minimum and maximum representing the starting and ending points of the progress bar. |
svg |
Either an svg path e.g.: |
progress_type |
The progress type, either |
fill_direction, stroke_direction
|
The direction which the progress bar should
take. Wether |
fill_color, stroke_color
|
The color to use for the progress bar.
Wether |
... |
Any other other advanced options to pass to the loaded see the official documentation. |
angle |
Angle of gradient. |
duration |
Duration of the loop. |
colors |
Color vectors composing the gradient. |
color_background |
The background of the color. |
color_bubble |
The color of the bubbles contour. |
count |
The number of bubbles. |
color1, color2
|
Colors of stripes. |
line
fan
circle
bubble
rainbow
energy
stripe
text
library(shiny) library(waiter) # diagonal line path <- "M10 10L90 30" ui <- fluidPage( useWaiter(), useHostess(), actionButton("draw", "redraw"), plotOutput("plot") ) server <- function(input, output) { dataset <- reactive({ input$draw hostess <- Hostess$new(min = 0, max = 10) hostess$set_loader( hostess_loader( progress_type = "stroke", stroke_color = hostess_stripe() ) ) waiter <- Waiter$new( "plot", hostess$loader() ) waiter$show() for(i in 1:10){ Sys.sleep(.2) hostess$inc(1) } runif(100) }) output$plot <- renderPlot(plot(dataset())) } if(interactive()) shinyApp(ui, server)library(shiny) library(waiter) # diagonal line path <- "M10 10L90 30" ui <- fluidPage( useWaiter(), useHostess(), actionButton("draw", "redraw"), plotOutput("plot") ) server <- function(input, output) { dataset <- reactive({ input$draw hostess <- Hostess$new(min = 0, max = 10) hostess$set_loader( hostess_loader( progress_type = "stroke", stroke_color = hostess_stripe() ) ) waiter <- Waiter$new( "plot", hostess$loader() ) waiter$show() for(i in 1:10){ Sys.sleep(.2) hostess$inc(1) } runif(100) }) output$plot <- renderPlot(plot(dataset())) } if(interactive()) shinyApp(ui, server)
Use a waitress progress bar with httr requests.
Simply use httr_progress where you would use
httr::progress.
httr_progress(object, type = c("down", "up"), pre = NULL, post = NULL)httr_progress(object, type = c("down", "up"), pre = NULL, post = NULL)
object |
The waitress or attendant object. |
type |
Type of progress to display: either number of bytes uploaded or downloaded. Passed to httr::progress. |
pre, post
|
Pre and callback functions to run before the progress starts or once it is done. |
## Not run: cap_speed <- httr::config(max_recv_speed_large = 10000) httr::GET( "http://httpbin.org/bytes/102400", httr_progress(w), cap_speed ) ## End(Not run)## Not run: cap_speed <- httr::config(max_recv_speed_large = 10000) httr::GET( "http://httpbin.org/bytes/102400", httr_progress(w), cap_speed ) ## End(Not run)
Toggle placeholders.
new()
Placeholder$new(
targets,
type = c("glow", "wave", "default"),
session = shiny::getDefaultReactiveDomain()
)targetsVector or list of selectors to turn into placeholders.
typeType of placeholder.
sessionValid shiny session.
Initialize
show()
Placeholder$show()
Show
hide()
Placeholder$hide()
Hide
clone()
The objects of this class are cloneable with this method.
Placeholder$clone(deep = FALSE)
deepWhether to make a deep clone.
Allows previewing spinners in web browser or RStudio Viewer.
preview_spinner(spinner, bg_color = "black")preview_spinner(spinner, bg_color = "black")
spinner |
A waiter |
bg_color |
Background color. |
if(interactive()) preview_spinner(spin_1())if(interactive()) preview_spinner(spin_1())
Spinkit spinners to use with waiter_show.
spin_rotating_plane() spin_fading_circles() spin_folding_cube() spin_double_bounce() spin_wave() spin_wandering_cubes() spin_pulse() spin_chasing_dots() spin_three_bounce() spin_circle() spin_rotate() spin_solar() spin_orbit() spin_squares() spin_cube_grid() spin_circles() spin_orbiter() spin_pixel() spin_flower() spin_dual_ring() spin_heart() spin_ellipsis() spin_facebook() spin_hourglass() spin_ring() spin_ripple() spin_terminal() spin_loader() spin_throbber() spin_refresh() spin_heartbeat() spin_gauge() spin_3k() spin_wobblebar() spin_atebits() spin_whirly() spin_flowers() spin_dots() spin_3circles() spin_plus() spin_pulsar() spin_hexdots() spin_inner_circles() spin_pong() spin_timer() spin_ball() spin_dual_circle() spin_seven_circle() spin_clock() spin_pushing_shapes() spin_fill() spin_rhombus() spin_balance() spin_square_circle() spin_circle_square() spin_puzzle() spin_half() spin_loaders(id = 1, color = "white", style = NULL) spin_1() spin_2() spin_3() spin_4() spin_5() spin_6() bs4_spinner( style = c("spin", "grow"), color = c("primary", "secondary", "success", "danger", "warning", "info", "light", "dark") ) bs5_spinner( style = c("spin", "grow"), color = c("primary", "secondary", "success", "danger", "warning", "info", "light", "dark") ) spin_google()spin_rotating_plane() spin_fading_circles() spin_folding_cube() spin_double_bounce() spin_wave() spin_wandering_cubes() spin_pulse() spin_chasing_dots() spin_three_bounce() spin_circle() spin_rotate() spin_solar() spin_orbit() spin_squares() spin_cube_grid() spin_circles() spin_orbiter() spin_pixel() spin_flower() spin_dual_ring() spin_heart() spin_ellipsis() spin_facebook() spin_hourglass() spin_ring() spin_ripple() spin_terminal() spin_loader() spin_throbber() spin_refresh() spin_heartbeat() spin_gauge() spin_3k() spin_wobblebar() spin_atebits() spin_whirly() spin_flowers() spin_dots() spin_3circles() spin_plus() spin_pulsar() spin_hexdots() spin_inner_circles() spin_pong() spin_timer() spin_ball() spin_dual_circle() spin_seven_circle() spin_clock() spin_pushing_shapes() spin_fill() spin_rhombus() spin_balance() spin_square_circle() spin_circle_square() spin_puzzle() spin_half() spin_loaders(id = 1, color = "white", style = NULL) spin_1() spin_2() spin_3() spin_4() spin_5() spin_6() bs4_spinner( style = c("spin", "grow"), color = c("primary", "secondary", "success", "danger", "warning", "info", "light", "dark") ) bs5_spinner( style = c("spin", "grow"), color = c("primary", "secondary", "success", "danger", "warning", "info", "light", "dark") ) spin_google()
id |
The spinner identifier, an integer between |
color |
Desired color of spinner. |
style |
CSS style to apply to spinner. |
Much of the CSS used is to provide those spinners.
One can greatly reduce the load on the browser by only sourcing
the CSS for the spinners required. You can find out which CSS kits
are required to load by using the spinner in the R console as
shown in the example. This prints the kit and instructions
to only source the required file.
An object of class spinner.
spin_rotating_plane()spin_rotating_plane()
A colorful steward to work with the waiter.
useSteward( colors = c("#ee7752", "#e73c7e", "#23a6d5", "#23d5ab"), speed = 30, angle = -45 ) use_steward( colors = c("#ee7752", "#e73c7e", "#23a6d5", "#23d5ab"), speed = 30, angle = -45 )useSteward( colors = c("#ee7752", "#e73c7e", "#23a6d5", "#23d5ab"), speed = 30, angle = -45 ) use_steward( colors = c("#ee7752", "#e73c7e", "#23a6d5", "#23d5ab"), speed = 30, angle = -45 )
colors |
Color palette forming gradient. |
speed |
Seconds it takes to loop over colors. |
angle |
Degrees at which colors slide. |
A convenience function to create a waiter with transparent background.
transparent(alpha = 0)transparent(alpha = 0)
alpha |
Alpha channel where |
transparent()transparent()
A a trigger to a waiting screen from the UI.
triggerWaiter( el, id = NULL, html = NULL, color = NULL, image = "", fadeout = FALSE, on = "click", hide_on_render = !is.null(id), hide_on_error = !is.null(id), hide_on_silent_error = !is.null(id) )triggerWaiter( el, id = NULL, html = NULL, color = NULL, image = "", fadeout = FALSE, on = "click", hide_on_render = !is.null(id), hide_on_error = !is.null(id), hide_on_silent_error = !is.null(id) )
el |
Element that triggers the waiter. |
id |
Id of element to hide or element on which to show waiter over. |
html |
HTML content of waiter, generally a spinner, see |
color |
Background color of loading screen. |
image |
Path to background image. |
fadeout |
Use a fade out effect when the screen is removed. Can be a boolean, or a numeric indicating the number of milliseconds the effect should take. |
on |
The event that triggers the waiter. |
hide_on_render |
Set to |
hide_on_error, hide_on_silent_error
|
Whether to hide the waiter when the underlying element throws an error. Silent error are thrown by req and validate. |
library(shiny) library(waiter) ui <- fluidPage( useWaiter(), triggerWaiter( actionButton( "generate", "Generate Plot" ) ), plotOutput("plot") ) server <- function(input, output){ output$plot <- renderPlot({ input$generate Sys.sleep(3) plot(runif(50)) }) } if(interactive()) shinyApp(ui, server)library(shiny) library(waiter) ui <- fluidPage( useWaiter(), triggerWaiter( actionButton( "generate", "Generate Plot" ) ), plotOutput("plot") ) server <- function(input, output){ output$plot <- renderPlot({ input$generate Sys.sleep(3) plot(runif(50)) }) } if(interactive()) shinyApp(ui, server)
Include in anywhere your shiny UI to import the dependencies required to run attendant progress.
useAttendant()useAttendant()
Placeholder dependencies to place withing Shiny UI.
usePlaceholder()usePlaceholder()
Programatically show and hide loading screens.
use_waiter(spinners = NULL, include_js = TRUE) useWaiter(spinners = NULL, include_js = TRUE) waiter_use(spinners = 1:7, include_js = TRUE) waiter_show( id = NULL, html = spin_1(), color = "#333e48", logo = "", image = "", hide_on_render = !is.null(id) ) waiter_show_on_load(html = spin_1(), color = "#333e48", image = "", logo = "") waiterShowOnLoad(html = spin_1(), color = "#333e48", image = "", logo = "") waiter_preloader( html = spin_1(), color = "#333e48", image = "", fadeout = FALSE, logo = "" ) waiterPreloader( html = spin_1(), color = "#333e48", image = "", fadeout = FALSE, logo = "" ) waiter_hide_on_render(id) waiterHideOnRender(id) waiter_on_busy( html = spin_1(), color = "#333e48", logo = "", image = "", fadeout = FALSE ) waiterOnBusy( html = spin_1(), color = "#333e48", logo = "", image = "", fadeout = FALSE ) waiter_hide(id = NULL) waiter_update(id = NULL, html = NULL)use_waiter(spinners = NULL, include_js = TRUE) useWaiter(spinners = NULL, include_js = TRUE) waiter_use(spinners = 1:7, include_js = TRUE) waiter_show( id = NULL, html = spin_1(), color = "#333e48", logo = "", image = "", hide_on_render = !is.null(id) ) waiter_show_on_load(html = spin_1(), color = "#333e48", image = "", logo = "") waiterShowOnLoad(html = spin_1(), color = "#333e48", image = "", logo = "") waiter_preloader( html = spin_1(), color = "#333e48", image = "", fadeout = FALSE, logo = "" ) waiterPreloader( html = spin_1(), color = "#333e48", image = "", fadeout = FALSE, logo = "" ) waiter_hide_on_render(id) waiterHideOnRender(id) waiter_on_busy( html = spin_1(), color = "#333e48", logo = "", image = "", fadeout = FALSE ) waiterOnBusy( html = spin_1(), color = "#333e48", logo = "", image = "", fadeout = FALSE ) waiter_hide(id = NULL) waiter_update(id = NULL, html = NULL)
spinners |
Deprecated argument. Spinners to include. By default all the CSS files for
all spinners are included you can customise this only that which you
need in order to reduce the amount of CSS that needs to be loaded and
improve page loading speed. There are 7 spinner kits. The spinner kit
required for the spinner you use is printed in the R console when
using the spinner. You can specify a single spinner kit e.g.: |
include_js |
Deprecated argument, no longer needed. |
id |
Id of element to hide or element on which to show waiter over. |
html |
HTML content of waiter, generally a spinner, see |
color |
Background color of loading screen. |
logo |
Path to logo to display. Deprecated. |
image |
Path to background image. |
hide_on_render |
Set to |
fadeout |
Use a fade out effect when the screen is removed. Can be a boolean, or a numeric indicating the number of milliseconds the effect should take. |
use_waiter and waiter_use: waiter dependencies to include anywhere in your UI but ideally at the top.
waiter_show_on_load: Show a waiter on page load, before the session is even loaded, include in UI after use_waiter.
waiter_show: Show waiting screen.
waiter_hide: Hide any waiting screen.
waiter_on_busy: Automatically shows the waiting screen when the server is busy, and hides it when it goes back to idle.
waiter_update: Update the content html of the waiting screen.
waiter_hide_on_render: Hide any waiting screen when the output is drawn, useful for outputs that take a long time to draw, use in ui.
waiter_preloader: Shows the waiter on load and automatically removes it once all the UI is rendered, only runs on the first load of the app.
library(shiny) ui <- fluidPage( useWaiter(), # dependencies waiterShowOnLoad(spin_fading_circles()), # shows before anything else actionButton("show", "Show loading for 5 seconds") ) server <- function(input, output, session){ waiter_hide() # will hide *on_load waiter observeEvent(input$show, { waiter_show( html = tagList( spin_fading_circles(), "Loading ..." ) ) Sys.sleep(3) waiter_hide() }) } if(interactive()) shinyApp(ui, server)library(shiny) ui <- fluidPage( useWaiter(), # dependencies waiterShowOnLoad(spin_fading_circles()), # shows before anything else actionButton("show", "Show loading for 5 seconds") ) server <- function(input, output, session){ waiter_hide() # will hide *on_load waiter observeEvent(input$show, { waiter_show( html = tagList( spin_fading_circles(), "Loading ..." ) ) Sys.sleep(3) waiter_hide() }) } if(interactive()) shinyApp(ui, server)
Create a waiter to then show, hide or update its content.
Create an object to show a waiting screen on either the entire application
or just a portion of the app by specifying the id. Then show,
then hide or meanwhile update the content of the waiter.
fadeoutSet or get the fade out
colorSet or get the background color
imageSet of get the background image
sessionSet or get the shiny session
htmlSet or get the html content
new()
Waiter$new( id = NULL, html = NULL, color = NULL, logo = NULL, image = "", fadeout = FALSE, hide_on_render = !is.null(id), hide_on_error = !is.null(id), hide_on_silent_error = !is.null(id) )
idId, or vector of ids, of element on which to overlay the waiter, if NULL the waiter is
applied to the entire body.
htmlHTML content of waiter, generally a spinner, see spinners or a list of the latter.
colorBackground color of loading screen.
logoLogo to display. Deprecated.
imagePath to background image of loading screen.
fadeoutUse a fade out effect when the screen is removed. Can be a boolean, or a numeric indicating the number of milliseconds the effect should take.
hide_on_renderSet to TRUE to automatically hide the waiter
when the element in id is drawn. Note the latter will work with
shiny plots, tables, htmlwidgets, etc. but will not work with arbitrary
elements.
hide_on_error, hide_on_silent_errorWhether to hide the waiter when the underlying element throws an error. Silent error are thrown by req and validate.
Create a waiter.
\dontrun{Waiter$new()}
show()
Waiter$show()
Show the waiter.
hide()
Waiter$hide()
Hide the waiter.
update()
Waiter$update(html = NULL)
htmlHTML content of waiter, generally a spinner, see spinners.
Update the waiter's html content.
print()
Waiter$print()
print the waiter
clone()
The objects of this class are cloneable with this method.
Waiter$clone(deep = FALSE)
deepWhether to make a deep clone.
## ------------------------------------------------ ## Method `Waiter$new` ## ------------------------------------------------ ## Not run: Waiter$new()## ------------------------------------------------ ## Method `Waiter$new` ## ------------------------------------------------ ## Not run: Waiter$new()
Define a theme to be used by all waiter loading screens. These can be overriden in individual loading screens.
waiter_set_theme(html = spin_1(), color = "#333e48", logo = "", image = "") waiter_get_theme() waiter_unset_theme()waiter_set_theme(html = spin_1(), color = "#333e48", logo = "", image = "") waiter_get_theme() waiter_unset_theme()
html |
HTML content of waiter, generally a spinner, see |
color |
Background color of loading screen. |
logo |
Path to logo to display. Deprecated. |
image |
Path to background image. |
Programatically show and hide loading bars.
useWaitress(color = "#697682", percent_color = "#333333") use_waitress(color = "#697682", percent_color = "#333333")useWaitress(color = "#697682", percent_color = "#333333") use_waitress(color = "#697682", percent_color = "#333333")
color, percent_color
|
Color of waitress and color of percent text shown when
|
You can pipe the methods with $.
Waitress$new() and call_waitress() are equivalent.
library(shiny) ui <- fluidPage( useWaitress("red"), # dependencies sliderInput("set", "percentage", 1, 100, step = 5, value = 1) ) server <- function(input, output, session){ w <- Waitress$ new()$ # call a waitress start() # start waitress observeEvent(input$set, { w$set(input$set) # set at percentage }) } if(interactive()) shinyApp(ui, server)library(shiny) ui <- fluidPage( useWaitress("red"), # dependencies sliderInput("set", "percentage", 1, 100, step = 5, value = 1) ) server <- function(input, output, session){ w <- Waitress$ new()$ # call a waitress start() # start waitress observeEvent(input$set, { w$set(input$set) # set at percentage }) } if(interactive()) shinyApp(ui, server)
Create a waitress (progress bar) and programmatically set or increase its percentage, then hide it when done.
maxMaximum value of the bar.
minMinimum value of the bar.
new()
Waitress$new(
selector = NULL,
theme = c("line", "overlay", "overlay-radius", "overlay-opacity", "overlay-percent"),
min = 0,
max = 100,
infinite = FALSE,
hide_on_render = FALSE
)selectorElement selector to apply the waitress to,
if NULL then the waitress is applied to the whole screen.
themeA valid theme, see function usage.
min, maxMinimum and maximum representing the starting and ending points of the progress bar.
infiniteSet to TRUE to create a never ending loading bar, ideal
when you cannot compute increments or assess the time it might take before the
loading bar should be removed.
hide_on_renderSet to TRUE to automatically hide the waitress
when the element in id is rendered. Note the latter will work with
shiny plots, tables, htmlwidgets, etc. but will not work with arbitrary
elements.
color, percent_colorColor of waitress and color of percent text shown when
theme is set to overlay-percent.
Create a waitress.
\dontrun{Waitress$new("#plot")}
start()
Waitress$start( html = NULL, background_color = "transparent", text_color = "black" )
htmlHTML content to show over the waitress, accepts htmltools and shiny tags.
background_colorThe background color of the html.
text_colorThe color of the html content.
Start the waitress.
\dontrun{Waitress$new("#plot")$start()}
notify()
Waitress$notify(
html = NULL,
background_color = "white",
text_color = "black",
position = c("br", "tr", "bl", "tl")
)htmlHTML content to show over the waitress, accepts htmltools and shiny tags.
background_colorThe background color of the html.
text_colorThe color of the html content.
positionPosition of the notification on the screen.
Where br is the bottom-right, tr is the top-right,
bl is bottom-left, and tl is the top-left.
Show the waitress as a notification.
\dontrun{Waitress$new()$notify()}
set()
Waitress$set(value)
valueValue to set waitress to.
Set the waitress to a specific percentage.
\dontrun{Waitress$new("#plot")$set(20)}
auto()
Waitress$auto(value, ms)
valueValue to set waitress to.
msNumber of Milliseconds
Automatically start and end the waitress.
\dontrun{Waitress$new("#plot")$auto(20, 2000)}
inc()
Waitress$inc(value)
valueValue to increase waitress to.
Increase the waitress by a percentage.
\dontrun{Waitress$new("#plot")$inc(30)}
close()
Waitress$close()
Close the waitress.
\dontrun{Waitress$new("#plot")$close()}
getMin()
Waitress$getMin()
Get minimum value
getMax()
Waitress$getMax()
Get maximum value
getValue()
Waitress$getValue()
Get current value
print()
Waitress$print()
Print the waitress.
\dontrun{Waitress$new("#plot")$hide()}
clone()
The objects of this class are cloneable with this method.
Waitress$clone(deep = FALSE)
deepWhether to make a deep clone.
## ------------------------------------------------ ## Method `Waitress$new` ## ------------------------------------------------ ## Not run: Waitress$new("#plot") ## ------------------------------------------------ ## Method `Waitress$start` ## ------------------------------------------------ ## Not run: Waitress$new("#plot")$start() ## ------------------------------------------------ ## Method `Waitress$notify` ## ------------------------------------------------ ## Not run: Waitress$new()$notify() ## ------------------------------------------------ ## Method `Waitress$set` ## ------------------------------------------------ ## Not run: Waitress$new("#plot")$set(20) ## ------------------------------------------------ ## Method `Waitress$auto` ## ------------------------------------------------ ## Not run: Waitress$new("#plot")$auto(20, 2000) ## ------------------------------------------------ ## Method `Waitress$inc` ## ------------------------------------------------ ## Not run: Waitress$new("#plot")$inc(30) ## ------------------------------------------------ ## Method `Waitress$close` ## ------------------------------------------------ ## Not run: Waitress$new("#plot")$close() ## ------------------------------------------------ ## Method `Waitress$print` ## ------------------------------------------------ ## Not run: Waitress$new("#plot")$hide()## ------------------------------------------------ ## Method `Waitress$new` ## ------------------------------------------------ ## Not run: Waitress$new("#plot") ## ------------------------------------------------ ## Method `Waitress$start` ## ------------------------------------------------ ## Not run: Waitress$new("#plot")$start() ## ------------------------------------------------ ## Method `Waitress$notify` ## ------------------------------------------------ ## Not run: Waitress$new()$notify() ## ------------------------------------------------ ## Method `Waitress$set` ## ------------------------------------------------ ## Not run: Waitress$new("#plot")$set(20) ## ------------------------------------------------ ## Method `Waitress$auto` ## ------------------------------------------------ ## Not run: Waitress$new("#plot")$auto(20, 2000) ## ------------------------------------------------ ## Method `Waitress$inc` ## ------------------------------------------------ ## Not run: Waitress$new("#plot")$inc(30) ## ------------------------------------------------ ## Method `Waitress$close` ## ------------------------------------------------ ## Not run: Waitress$new("#plot")$close() ## ------------------------------------------------ ## Method `Waitress$print` ## ------------------------------------------------ ## Not run: Waitress$new("#plot")$hide()
Report progress with attendant.
withProgressAttendant( expr, ..., session = getDefaultReactiveDomain(), env = parent.frame(), quoted = FALSE ) setProgressAttendant( value = 1, text = NULL, session = getDefaultReactiveDomain() ) incProgressAttendant( value = 1, text = NULL, session = getDefaultReactiveDomain() )withProgressAttendant( expr, ..., session = getDefaultReactiveDomain(), env = parent.frame(), quoted = FALSE ) setProgressAttendant( value = 1, text = NULL, session = getDefaultReactiveDomain() ) incProgressAttendant( value = 1, text = NULL, session = getDefaultReactiveDomain() )
expr |
The work to be done.
This expression should contain calls to
setProgressAttendant |
... |
Passed to the Attendant constructor ( |
session |
The Shiny session object, as provided by
|
env |
The environment in which |
quoted |
Whether |
value |
Value to set the waitress to or increase it by. |
text |
Text to display on the progress bar. |
Report progress with waitress.
withProgressWaitress( expr, ..., session = getDefaultReactiveDomain(), env = parent.frame(), quoted = FALSE ) setProgressWaitress(value = 1, session = getDefaultReactiveDomain()) incProgressWaitress(value = 1, session = getDefaultReactiveDomain())withProgressWaitress( expr, ..., session = getDefaultReactiveDomain(), env = parent.frame(), quoted = FALSE ) setProgressWaitress(value = 1, session = getDefaultReactiveDomain()) incProgressWaitress(value = 1, session = getDefaultReactiveDomain())
expr |
The work to be done.
This expression should contain calls to
setProgressWaitress |
... |
Passed to the Waitress constructor ( |
session |
The Shiny session object, as provided by
|
env |
The environment in which |
quoted |
Whether |
value |
Value to set the waitress to or increase it by. |
Adds a waiter to a rective UI element. Thew waiter is displayed when the element is invalidated then is removed when the element receives a new value.
withWaiter(element, html = spin_1(), color = "#333e48", image = "")withWaiter(element, html = spin_1(), color = "#333e48", image = "")
element |
A reactive element, e.g.: |
html |
HTML content of waiter, generally a spinner, see |
color |
Background color of loading screen. |
image |
Path to background image. |