ValueBoxOutput to have blinking feature

Has anyone implemented something like this before?
What I need to have a blinking text in the ValueBoxOutput to raise some alert to the user.
Thanks.

Hi,

Here is a way to got this done using this nice online CSS example:

library(shiny)
library(shinydashboard)

ui <- shinyUI(
  fluidPage(
    
    #Add the CSS to blink
    tags$head(tags$style(
      type="text/css", 
      ".blinkMe {
        animation: blinker 1s linear infinite;
      }
      
      @keyframes blinker {  
      50% { opacity: 0; }
      }"
      
      )),
     
    
    #Only blink title
    valueBox(HTML("<div class = blinkMe>test</div>"), "test"),
    
    #Blink everything
    div(class = "blinkMe", valueBox("test2", "test"))

  )
)

server <- function(input, output){

}

shinyApp(ui, server)

The trick is that if Shiny does not have something included that can be done with JS or CSS, you can always 'force' it by creating your own classes or referencing the Shiny class / ID and adding custom stuff.

Hope this helps,
PJ

1 Like

PERFECT. This is what I am looking for, THANK YOU, PJ.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.