Search code examples
rshinydashboardshinydashboard

How to modify headings in conditionalPanel in Shiny R


I created a dashboard in Shiny R on which a text should only be displayed under certain conditions which are defined in my server class:

output$is_old_data <- reactive(
    if(get_most_recent_date2(dshb_qt_2, input$radio)){
      1
    }else{
      0
    }
  )
  outputOptions(output, "is_old_data", suspendWhenHidden = FALSE)

In the UI I created the following:

h5(
                  conditionalPanel("output.is_old_data == 1", h5("Os dados apresentados infra dizem respeito ao calculo efectuado
                                                                 para a ultima data de referencia com dados disponiveis. Assim que 
                                                                 possivel a informacao sera actualizada para o mes seleccionado."))
                ),

However, I would like to make the text bold and change the color. Any suggestions on that?


Solution

  • Add tags$b() for bold and style="color: blue;" (or any other color).

    library(shiny)
    
    ui <- fluidPage(
        h5(
            tags$b("Os dados apresentados infra dizem respeito ao calculo efectuado
                    para a ultima data de referencia com dados disponiveis. Assim que 
                    possivel a informacao sera actualizada para o mes seleccionado.", 
                   style="color: blue;")
        )
    )
    
    server <- function(input, output, session) {
        
    }
    
    shinyApp(ui, server)