Description Usage Arguments Value Examples
Create a new progress bar in your shiny app. This progress bar was designed for apps that many pages that are viewed in a given order. This may be useful apps that have a series of instructions screens or that are designed for qualitative data collection (i.e., survey data). For example, let's say that an app has 10 instruction pages. The user is instructed to read through all pages and use the navigation buttons (next and back) to move between pages. The progress bar can be useful in this situation as it visually shows how many pages are left.
1 | progressbar(start = 0, min = 0, max = 7)
|
start |
the starting point for the progress bar |
min |
the minimum value of the progress bar |
max |
the maximum value of the progress bar |
Create a new progress bar
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 30 31 32 | if (interactive()) {
library(shiny)
mybar <- iceComponents::progressbar(max = 10)
ui <- tagList(
iceComponents::use_accessibleshiny(),
tags$main(
style = "display: block; height: 50vh; margin-top: 50px",
actionButton("increaseBar", "Next"),
actionButton("descreaseBar", "Previous")
),
mybar$bar(
id = "bar1",
fixed = TRUE
)
)
server <- function(input, output) {
mybar$listen()
observeEvent(input$increaseBar, {
mybar$increase()
})
observeEvent(input$descreaseBar, {
mybar$decrease()
})
}
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.