Add Loading Animations to a 'shiny' Output While It's Recalculating

When a 'Shiny' output (such as a plot, table, map, etc.) is recalculating, it remains visible but gets greyed out. Using 'shinycssloaders', you can add a loading animation ("spinner") to outputs instead. By wrapping a 'Shiny' output in 'withSpinner()', a spinner will automatically appear while the output is recalculating. See the demo online at <>.

Add loader animations (spinners) to Shiny Outputs (e.g. plots, tables) in an automated fashion. Loading animations leverage on Shiny JS events and will show whilst the output value is not yet available or is 'out-of-date' (i.e. has been invalidated and the client hasn't received the new value). The spinners won't show if the output is not rendered (e.g. a validate or req is preventing it from being shown).

The advantages of using this package are:

  • Automatic spinner showing / hiding. Just add one extra R function call (see below) and your output will have the spinner showing at just the right times
  • Customizeable spinner colour (for each output or globally)
  • Customizeable spinner size (for each output or globally)
  • Choose from 8 different well-designed spinner types

The CSS animations are bundled from, where you can see how they appear.

You can use it for any type of shiny output, by wrapping the UI element with the withSpinner tag:

# load the library


# if you have `%>%` loaded, you can do plotOutput("my_plot") %>% withSpinner()



The package is now available on CRAN (for outputs with variable heights, use the github version instead), however for the latest (and hopefully greatest!) version you can use the devtools package to install it from github directly:



To see how this works in action, you can check my example on or run the example application from github directly:


To see how the spinner works for outputs with undefined height, you can check out this example or run it from github directly:


Changing the spinner colour

You can specify a spinner colour for each output or set a variable globally.

Locally for each output

Just add color attribute to withSpinner:

plotOutput("my_plot") %>% withSpinner(color="#0dc5c1")


You can use options(spinner.color="#0dc5c1") to set the global colour.

Background color

Spinner types 2-3 require you to specify a background color as well, which should match the background color of the container hosting the output. The other spinners work automatically without having to specify a background color.

Changing the spinner size

The spinners scale in a relative fashion by specifying the size argument of withSpinner (default value is 1, so if you need to double the spinner for example, set size to 2). You can also set the size globally using options(spinner.size=my_size).


shinycssloaders 0.2.0

New features

  • Better support for outputs with non-fixed height (e.g. tables with heights depending on the data received from the server), by embedding a 'proxy' container which contains the spinner. An attempt is made to automatically deduce if the output has fixed / variable height and in the latter case the proxy container will have a default height of '400px'. Otherwise the proxy.height option can be used to explicitly control the size of the proxy container.


  • Fix vertical scroll-bar appearing for Type 3 spinners
  • Fix error message still showing when recalculating for htmlwidgets

shinycssloaders 0.1.0

The first working version of the package.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.0.0 by Dean Attali, a year ago

Report a bug at

Browse source code at

Authors: Andras Sali [aut] (Original creator of shinycssloaders package) , Luke Hass [ctb, cph] (Author of included CSS loader code) , Dean Attali [aut, cre] (Maintainer of shinycssloaders since 2019)

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports digest, glue, grDevices, shiny

Suggests shinydisconnect, shinyjs

Imported by AovBay, AtmChile, CaPO4Sim, DCEtool, ExPanDaR, FielDHub, GMSE, GWSDAT, LDAShiny, MapeBay, OpenRepGrid.ic, PSS.Health, ReviewR, SOMEnv, animaltracker, autoTS, azuremlsdk,, drawsample, easylabel, eirm, farrell, gde, genogeographer, irtGUI, memery, polished, populationPDXdesign, precisely, shinyIRT, shinyML, shinyrecap, toxEval, visxhclust, wilson, wiseR.

Depended on by RSCAT, SRS.

Suggested by CNVScope, Clustering, HaDeX, PCRedux, SOMbrero, bibliometrix, bsem, cNORM, clusterPower, conos, countfitteR, deepdep, eq5d, influential, microsamplingDesign, nCov2019, nph, nse2r, shinycustomloader, simplevis, xplorerr.

See at CRAN