Description Usage Arguments Examples
View source: R/shiny-material-spinner.R
Display a preloader (spinner) while server is busy.
1 | material_spinner_show(session, output_id)
|
session |
The session object passed to function given to shinyServer. |
output_id |
The output id for which the spinner will be a placeholder for. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | if(interactive()){
library(shiny)
library(shinymaterial)
ui <- material_page(
title = "Spinner Example",
numericInput(inputId = "n", label = "", value = 10),
plotOutput("n_plot")
)
server <- function(input, output, session) {
output$n_plot <- renderPlot({
#--- Show the spinner ---#
material_spinner_show(session, "n_plot")
#--- Simulate calculation step ---#
Sys.sleep(time = 5)
#--- Hide the spinner ---#
material_spinner_hide(session, "n_plot")
plot(1:input$n)
})
}
shinyApp(ui = ui, server = server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.