Title: | Custom Loader for Shiny Outputs |
---|---|
Description: | A custom css/html or gif/image file for the loading screen in R 'shiny'. It also can use the marquee to have custom text loading screen. |
Authors: | Emi Tanaka and Niichan |
Maintainer: | Emi Tanaka <[email protected]> |
License: | GPL-3 |
Version: | 0.9.0 |
Built: | 2024-12-07 06:36:35 UTC |
Source: | CRAN |
This creates the necessary elements for marquee to make custom text loading screen. This function is to be used as input list in withLoader or renderCSS functions.
marquee(content, behavior = "scroll", direction = "left", scrollamount = 6, width = "100%", ...)
marquee(content, behavior = "scroll", direction = "left", scrollamount = 6, width = "100%", ...)
content |
The text content of the marquee. |
behavior |
Sets how the text is scrolled within the marquee. Possible values are scroll, slide and alternate. If no value is specified, the default value is scroll. |
direction |
Sets the direction of the scrolling within the marquee. Possible values are left, right, up and down. If no value is specified, the default value is left. |
scrollamount |
Sets the amount of scrolling at each interval in pixels. The default value is 6. |
width |
Sets the width in pixels or percentage value. |
... |
Other parameters passed to the marquee such as height, bgcolor. |
marquee("Custom loading text here...", height=60, width=100)
marquee("Custom loading text here...", height=60, width=100)
This function follows similar to withLoader but needs no UI element. This allows for a permanent loading screen.
renderCSS(type, loader)
renderCSS(type, loader)
type |
The type of loader to use. Possible values are image, html or text. |
loader |
The name of the loader. The built in options are dnaspin, dancingtree, pacman and walkingcow. For custom html option, the name of the css and html file have to be the same and input must be without the extension. For custom text option, loader must be a list of marquee objects. |
## Not run: marquee_list <- list(marquee("Your custom text here")) ## Not run: renderCSS(type="text", loader=marquee_list)
## Not run: marquee_list <- list(marquee("Your custom text here")) ## Not run: renderCSS(type="text", loader=marquee_list)
This package extends the shinycssloaders
R-package to allow for custom css animations
or external gifs for loading animations by wrapping a function around the shiny output.
The package contains built-in css animations such as a spinning DNA animation, walking cow animation
and a pacman animation.
For further reference see https://github.com/emitanaka/shinycustomloader.
Shows an example shiny app with the built-in load screens.
shinyExample()
shinyExample()
## Not run: shinyExample()
## Not run: shinyExample()
Add a loader that shows when an output is recalculating
withLoader(ui_element, type = "html", loader = "dnaspin", proxy.height = if (grepl("height:\\s*\\d", ui_element)) NULL else "400px")
withLoader(ui_element, type = "html", loader = "dnaspin", proxy.height = if (grepl("height:\\s*\\d", ui_element)) NULL else "400px")
ui_element |
A UI element that should be wrapped with a loader when the corresponding output is being calculated. |
type |
The type of loader to use. Possible values are image, html or text. |
loader |
The name of the loader. The built in options are dnaspin, dancingtree, pacman and walkingcow. For custom html option, the name of the css and html file have to be the same and input must be without the extension. For custom image option, the name must include the extension of the file. For custom text option, loader must be a list of marquee objects. |
proxy.height |
If the output doesn't specify the output height, you can set a proxy height. It defaults to 400px for outputs with undefined height. |
'shinycssloaders' https://github.com/andrewsali/shinycssloaders
'dnaspin' https://codepen.io/jsnanigans/pen/ORNJNp
'pacman' https://codepen.io/wifi/pen/olKxE
'loaders' https://codepen.io/Manoz/pen/pydxK
## Not run: withLoader(plotOutput("my_plot")) ## Not run: marquee_list <- list(marquee("Your custom text here")) ## Not run: withLoader(plotOutput("distPlot"), type="text", loader=marquee_list)
## Not run: withLoader(plotOutput("my_plot")) ## Not run: marquee_list <- list(marquee("Your custom text here")) ## Not run: withLoader(plotOutput("distPlot"), type="text", loader=marquee_list)