Render title in R shiny box dynamically

I am trying to render the title for the boxes I am using in R shiny dynamically.

As of now the box code looks like this

 box(
            title = "lorem ipsum",
            width = 6,
            solidHeader = TRUE,
            status = "primary",
            tableOutput("consumption"),
            collapsible = T
          )

Is it possible to use render text in server and pass the text as a title:

 con1 <- renderText({
   if (age() == FALSE)
       {
         return("lorem1")

       }
       else
       {
         return("lorem2")
       }
 })

Yes that's possible by using a textOutput.

 box(
            title = textOutput("con1"),
            width = 6,
            solidHeader = TRUE,
            status = "primary",
            tableOutput("consumption"),
            collapsible = T
          )

 output$con1 <- renderText({
   if (age() == FALSE)
       {
         return("lorem1")
       }
       else
       {
         return("lorem2")
       }
 })
4 Likes