shinybiocloader: CSS loader for shiny apps

Marcel Ramos

2025-09-19

shinybiocloader

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.

Installation

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install("shinybiocloader")

Usage

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)

Session Information

sessionInfo()
R version 4.5.1 Patched (2025-08-23 r88802)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04.3 LTS

Matrix products: default
BLAS:   /home/biocbuild/bbs-3.22-bioc/R/lib/libRblas.so 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0  LAPACK version 3.12.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_GB              LC_COLLATE=C              
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: America/New_York
tzcode source: system (glibc)

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