| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/busy-indicators.R |
| 3 |
\name{useBusyIndicators} |
| 4 |
\alias{useBusyIndicators} |
| 5 |
\title{Enable/disable busy indication} |
| 6 |
\usage{ |
| 7 |
useBusyIndicators(..., spinners = TRUE, pulse = TRUE, fade = TRUE) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{...}{Currently ignored.} |
| 11 |
|
| 12 |
\item{spinners}{Whether to show a spinner on each calculating/recalculating |
| 13 |
output.} |
| 14 |
|
| 15 |
\item{pulse}{Whether to show a pulsing banner at the top of the page when the |
| 16 |
app is busy.} |
| 17 |
|
| 18 |
\item{fade}{Whether to fade recalculating outputs. A value of \code{FALSE} is |
| 19 |
equivalent to \code{busyIndicatorOptions(fade_opacity=1)}.} |
| 20 |
} |
| 21 |
\description{ |
| 22 |
Busy indicators provide a visual cue to users when the server is busy |
| 23 |
calculating outputs or otherwise performing tasks (e.g., producing |
| 24 |
downloads). When enabled, a spinner is shown on each |
| 25 |
calculating/recalculating output, and a pulsing banner is shown at the top of |
| 26 |
the page when the app is otherwise busy. Busy indication is enabled by |
| 27 |
default for UI created with \pkg{bslib}, but must be enabled otherwise. To |
| 28 |
enable/disable, include the result of this function in anywhere in the app's |
| 29 |
UI. |
| 30 |
} |
| 31 |
\details{ |
| 32 |
When both \code{spinners} and \code{pulse} are set to \code{TRUE}, the pulse is |
| 33 |
automatically disabled when spinner(s) are active. When both \code{spinners} and |
| 34 |
\code{pulse} are set to \code{FALSE}, no busy indication is shown (other than the |
| 35 |
graying out of recalculating outputs). |
| 36 |
} |
| 37 |
\examples{ |
| 38 |
\dontshow{if (rlang::is_interactive()) withAutoprint(\{ # examplesIf} |
| 39 |
|
| 40 |
library(bslib) |
| 41 |
|
| 42 |
ui <- page_fillable( |
| 43 |
useBusyIndicators(), |
| 44 |
card( |
| 45 |
card_header( |
| 46 |
"A plot", |
| 47 |
input_task_button("simulate", "Simulate"), |
| 48 |
class = "d-flex justify-content-between align-items-center" |
| 49 |
), |
| 50 |
plotOutput("p"), |
| 51 |
) |
| 52 |
) |
| 53 |
|
| 54 |
server <- function(input, output) { |
| 55 |
output$p <- renderPlot({ |
| 56 |
input$simulate |
| 57 |
Sys.sleep(4) |
| 58 |
plot(x = rnorm(100), y = rnorm(100)) |
| 59 |
}) |
| 60 |
} |
| 61 |
|
| 62 |
shinyApp(ui, server) |
| 63 |
\dontshow{\}) # examplesIf} |
| 64 |
} |
| 65 |
\seealso{ |
| 66 |
\code{\link[=busyIndicatorOptions]{busyIndicatorOptions()}} for customizing the appearance of the busy |
| 67 |
indicators. |
| 68 |
} |