Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add a CSS spinner #762

Closed
gshotwell opened this issue Oct 12, 2023 · 4 comments
Closed

How to add a CSS spinner #762

gshotwell opened this issue Oct 12, 2023 · 4 comments

Comments

@gshotwell
Copy link
Contributor

We don't currently have a great loading indicator when long-running computations cause components to take a long time to run. A user asked for a simple CSS spinner similar to shinyloaders, and we put together a simple example of how to get this sort of behaviour.

The basic pattern is to define a function which wraps children in a div, and then use CSS to add a spinner when that class is recalculating.

@stephenwilliams22
Copy link

@gshotwell Thanks for adding this example. However, when I add this spinner to an interactive plot, https://shiny.posit.co/py/docs/outputs.html#interactive-plots-1 for example, it seems to completely interfere with the interactivity of the plot. For example hovering gives no information in the plotly plot. Same with altair. Do you have suggestions on how to update this to not interfere with interactive plots?

@gshotwell gshotwell reopened this Nov 22, 2023
@iainmwallace
Copy link

It also interferes with click events on a table

@iainwallacebms
Copy link

In case it is helpful, I have created an example that shows this issue here

Two issues with this approach are:

  1. The spinner is only displayed when a selection is made
  2. The plot is not interactive anymore

Per a suggestion, I added an additional css snippet for not recalculating but unfortunately that didn't help

@cpsievert
Copy link
Collaborator

We now have spinners by default, and you can customize them via ui.busy_indicators.options()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants