if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("shinybiocloader")2025-09-19
This package is intended for shiny app developers. It provides a simple way to add a loading animation to a shiny application when processing data or rendering outputs.
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("shinybiocloader")You can use the withLoader function to wrap any UI element that you want to display a loader for. The loader can be specified by its name, such as “biocspin” though there is only one loader in the package currently.
library(shiny)
library(shinybiocloader)
ui <- fluidPage(
titlePanel("shinybiocloader demo"),
sidebarLayout(
sidebarPanel(
actionButton("load_data", "Load Data")
),
mainPanel(
withLoader(
plotOutput("plot"), loader = "biocspin"
)
)
)
)
server <- function(input, output) {
observeEvent(input$load_data, {
output$plot <- renderPlot({
hist(rnorm(1000), main = "Random Normal Distribution")
})
})
}
shinyApp(ui = ui, server = server)sessionInfo()R version 4.5.1 Patched (2025-09-10 r88807)
Platform: aarch64-apple-darwin20
Running under: macOS Ventura 13.7.7
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.1
locale:
[1] C/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/New_York
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.5.1 fastmap_1.2.0 cli_3.6.5 tools_4.5.1
[5] htmltools_0.5.8.1 yaml_2.3.10 rmarkdown_2.29 knitr_1.50
[9] jsonlite_2.0.0 xfun_0.53 digest_0.6.37 rlang_1.1.6
[13] png_0.1-8 evaluate_1.0.5