1

I'd like to have KPI inside R Shiny tabpanel titles, like below, is there an elegant way to do this or a package which can do it? (Please note, the chart is irrelevant to the question).

enter image description here

This is my attempt:

enter image description here

Here is the code:

library(shinydashboard)

ui <- fluidPage({
  ib1 <- infoBox("Test 1", 10 * 2, icon = icon("credit-card"), fill = TRUE)
  ib2 <- infoBox("Test 2", 10 * 2, icon = icon("table"), fill = TRUE)
  
  tabsetPanel(
    tabPanel(ib1, plotOutput("plot")),
    tabPanel(ib2)
  )  
})

server <- function(input, output, session) {
  
  output$plot <- renderPlot({
    hist(
      rnorm(100),
      main = paste("n =", 100),
      xlab = ""
    )
  })
  
}

shinyApp(ui, server)
Vlad
  • 3,058
  • 4
  • 25
  • 53
  • It seems like this could help you: https://stackoverflow.com/questions/47896844/shiny-dynamically-change-tab-names. – BrianLang Aug 21 '20 at 06:14

0 Answers0