modal-spinner {shinybusy} | R Documentation |
Show a modal with a spinner
Description
Make a pop-up window appear from the server with a spinner during long computation, remove it when finished.
Usage
show_modal_spinner(
spin = "double-bounce",
color = "#112446",
text = NULL,
session = shiny::getDefaultReactiveDomain()
)
remove_modal_spinner(session = getDefaultReactiveDomain())
update_modal_spinner(text, session = shiny::getDefaultReactiveDomain())
Arguments
spin |
Style of the spinner, see |
color |
Color for the spinner, in a valid CSS format. |
text |
Additional text to appear under the spinner. |
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_spinner()
Sys.sleep(5)
remove_modal_spinner()
})
observeEvent(input$sleep2, {
show_modal_spinner(
spin = "cube-grid",
color = "firebrick",
text = "Please wait..."
)
Sys.sleep(5)
remove_modal_spinner()
})
}
shinyApp(ui, server)
}
[Package shinybusy version 0.3.3 Index]