shiny_progress | R Documentation |
Wrapper of shiny progress that can run without shiny
shiny_progress( title, max = 1, ..., quiet = FALSE, session = shiny::getDefaultReactiveDomain(), shiny_auto_close = FALSE, log = NULL, outputId = NULL )
title |
the title of the progress |
max |
max steps of the procedure |
... |
passed to initialization method of |
quiet |
whether the progress needs to be quiet |
session |
shiny session domain |
shiny_auto_close |
whether to close the progress once function exits |
log |
alternative log function |
outputId |
the element id of |
a list of functions that controls the progress
{ progress <- shiny_progress("Procedure A", max = 10) for(i in 1:10){ progress$inc(sprintf("Step %s", i)) Sys.sleep(0.1) } progress$close() } if(interactive()){ library(shiny) ui <- fluidPage( fluidRow( column(12, actionButton("click", "Click me")) ) ) server <- function(input, output, session) { observeEvent(input$click, { progress <- shiny_progress("Procedure B", max = 10, shiny_auto_close = TRUE) for(i in 1:10){ progress$inc(sprintf("Step %s", i)) Sys.sleep(0.1) } }) } shinyApp(ui, server) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.