material_spinner_show {shinymaterial} | R Documentation |
Create a material preloader (spinner)
Description
Display a preloader (spinner) while server is busy.
Usage
material_spinner_show(session, output_id)
Arguments
session |
The session object passed to function given to shinyServer. |
output_id |
The output id for which the spinner will be a placeholder for. |
Examples
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)
}
[Package shinymaterial version 1.2.0 Index]