modal-gif {shinybusy} | R Documentation |
Show a modal with a GIF
Description
Make a pop-up window appear from the server with a GIF during long computation, remove it when finished.
Usage
show_modal_gif(
src,
text = NULL,
height = "100px",
width = "100px",
modal_size = "s",
session = shiny::getDefaultReactiveDomain()
)
remove_modal_gif(session = getDefaultReactiveDomain())
Arguments
src |
Path to the GIF, an URL or a file in www/ folder. |
text |
Additional text to appear under the spinner. |
height , width |
Height and width of the spinner, default to |
modal_size |
One of |
session |
The |
Examples
if (interactive()) {
library(shiny)
library(shinybusy)
ui <- fluidPage(
tags$h1("Modal with spinner"),
actionButton("sleep1", "Launch a long calculation"),
actionButton("sleep2", "And another one")
)
server <- function(input, output, session) {
observeEvent(input$sleep1, {
show_modal_gif(
src = "https://jeroen.github.io/images/banana.gif"
)
Sys.sleep(5)
remove_modal_gif()
})
observeEvent(input$sleep2, {
show_modal_gif(
src = "https://jeroen.github.io/images/banana.gif",
width = "300px", height = "300px",
modal_size = "m",
text = "Please wait..."
)
Sys.sleep(5)
remove_modal_gif()
})
}
shinyApp(ui, server)
}
[Package shinybusy version 0.3.3 Index]